C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old April 11th, 2002, 02:03 PM
lilpig lilpig is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 0 lilpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Intersection between Two Sorted List

Dear all,

I need to seek help with one of my tutorials, which i am terribly stuck with.

The question is :

Given two sorted lists, L1 and L2, and write a procedure to compute L1 n L2 (intersection) using only the basic list operations.


I need a full running program for this question.
But i only managed to get some simple codings done, which i don't even know if i am right.

My simple codes :

stack nodes;
while (L1_cur_node != NULL or L2_cur_node != NULL)
if (L1_cur_node.data = = L2_cur_node.data) {
nodes.push (L1_cur_node.data);
L1_cur_node = L1_cur_node.next;
L2_cur_node = L2_cur_node.next
} else if (L1_cur_node.data < L2_cur_node.data) {
L1_cur_node = L1_cur_node.next;
} else {
L2_cur_node = L2_cur_node.next;
}
}


Can someone please help me with a full running program?

Thank you.

lilpig

Reply With Quote
  #2  
Old April 12th, 2002, 08:48 AM
lilpig lilpig is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 0 lilpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have got my program up and running already.
Thanks for reading.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Intersection between Two Sorted List


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway