473,404 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

got ex questtion here...

guys, this question is easy, but i am new in data structure. got confusion here. need help. and please, reduce my headache..kkk...thanks a lot...
Q=>
Write a statement or set of statements to accomplish each of the following. Assume that all the manipulations occur in main (therefore, no addresses of pointer variables are needed), and assume the following definitions:

struct gradeNode
{
char lastname[20];
double grade;
struct gradeNode *nextPtr;
};
typedef struct gradeNode GradeNode;
typedef GradeNode *GradeNodePtr;

1.Create a pointer of the start of the list called startPtr. The list is empty.
2.Create a new node of type GradeNode that is pointed to by pointer newPtr of type GradeNodePtr. Assign the string “Jones” to member lastName and the value 91.5 to member grade (use strcpy). Provide any necessary declarations and statements.
3.Assume that the list pointed to by startPtr currently consists of 2 nodes - one containing “Jones” and one containing “Smith”. The nodes are in alphabetical order. Provide the statements necessary to insert in order nodes containing the following data for lastName and grade:
“Adams” 85.0
“Thompson” 73.5
“Pritchard” 66.5
4.Use pointers previousPtr, currentPtr and newPtr to perform the insertions. State what previousPtr and currentPtr point to before each insertion. Assume that newPtr always points to the new node, and that the new node has already been assigned the data.
5.Write a while loop that prints the data in each node of the list. Use pointer currentPtr to move along the list.
Aug 4 '07 #1
2 1524
JosAH
11,448 Expert 8TB
guys, this question is easy, but i am new in data structure. got confusion here. need help. and please, reduce my headache..kkk...thanks a lot...
That's a nice homework assignment you've got there. We don't hand out boiler
plate code here, we can help you though when you're stuck with something.
What have you done yourself sofar? You could go to www.rentacoder.com, but
you have to pay for it to get your spoonfed code (quite normal, if you'd ask me,
everybody needs money to live). So what's up?

kind regards,

Jos
Aug 4 '07 #2
That's a nice homework assignment you've got there. We don't hand out boiler
plate code here, we can help you though when you're stuck with something.
What have you done yourself sofar? You could go to www.rentacoder.com, but
you have to pay for it to get your spoonfed code (quite normal, if you'd ask me,
everybody needs money to live). So what's up?

kind regards,

Jos

thanks for reply. yup..so far, i got something. i got the idea. i know the linked list concept but the confusion start because my lecturer doesnt want us to use sth like 'newNode.lastname' where she wants us to use 'newNodePtr -> lastname' and use strcpy and strcmp.then typedef thing, i don't really familiar using typedef. so far..i am into something now. using my logic . hope God will help me. hahaha.
anyway, this is my minor course. but kind of like it. hehe..
Aug 5 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: manuel | last post by:
In the sample below, the foo function modify the b list, but I think it should modify only c, not b! It work correctly if if b is one dimension list instead two. def foo(aList): print "use...
2
by: ariza | last post by:
greetings. it seems that the attribute site.here, of the site module, has vanished in python 2.4. up until python 2.3, site.here seemed (to me at least) a convenient way to get the complete path to...
15
by: DavidS | last post by:
Have Visual Studio.NET installed on MS 2000 Professional OS laptop. No issue ever with web development and SQL connections. Purchased new laptop with XP Professional SP2!!!!!!!! & Visual...
22
by: Rob R. Ainscough | last post by:
Sorry to hear about the job cuts and Oracle now out sourcing to India. Rob.
0
by: Ramprasad | last post by:
Life is Different here, sky has no limit but you must grip it with this website, your Mirror of mind are present there. Whatever you want related to your everyday life, it can present or give...
1
by: leighahh | last post by:
Hi everyone i was wondering if there was a way to turn this code that is css into HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
2
by: dibblm | last post by:
I'll start this hopefully simple and add code where needed or requested. Im using a combobox that bound to a DataSet. The Dataset retreives it's values from SQL. I can retreive the values...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.