Solved

# How to use pseudocodes in linked list?

Posted on 2003-03-11
Medium Priority
2,363 Views

pointsTail = new node;
strcpy(pointsTail->playerName, "COMPUTER");
pointsTail->playerPoint = 0;

How can I simply tell the above algorithm in Pseudocodes?
Thanks....
0
Question by:joely2k
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 1

Expert Comment

ID: 8118665
not sure what you mean but try this

pointsTail <-- allocate node
pointsTail.playerPoint <-- 0

as you my know different software dev firms may write there pseudocode different. There is no set standard for it.
Oh ya you should really write psuedocode first then write your code, it will be good practice for you when you get to the REAL job.
0

Accepted Solution

originalrobby earned 120 total points
ID: 8120738
There are several ways to do it in pseudocode, different formal templates, here is a formal one used everywhere:

Pre: none
Returns: 1 for insertion or 0 for failed insertion
- allocate memory for node
- store data in node

Algorithm insert_at_middle()
Pre: list must not be empty
Post: inserts a node sorted somewhere in the list
Returns: 1 for insertion or 0 for failed insertion
- allocate memory for node
- store data in node
- make previous pointer point to this new pointer and this new pointer to next to connect chain
End Algorithm insert_at_middle()

Algorithm insert_at_end()
Pre: list must not be empty and next available pointer is null/tail(end of list)
Post: returns 1 for insertion or 0 for failed insertion and creates a circular list
- allocate memory for node
- store data in node
- connect the the tail node to the head node
End Algorithm insert_at_end()

There that is the pseudocode for you code, I am assuming you are inserting at head, middle and end and creating a circular list with your last statement pointsTail->pointsHead.next.

Although your code is not functional, this is the pseudocode for that code.

Regards,

Robert Mezei
Programmer/Analyst
0

Expert Comment

ID: 9447199
joely2k:
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
Simple Linear Regression
Progress
###### Suggested Courses
Course of the Month14 days, 21 hours left to enroll