Write a program that implements the linked list

Assignment Help Data Structure & Algorithms
Reference no: EM13161578

Write a program that implements the linked list Include the Node struct, the typedef NodePtr statement, and the head_insert() function Then write a main() that does these steps: creates a head for the list. add one item to the list. call head_insert() to add another 4 items to the list. Make sure each item has a different value for data. When you can do this without syntax errors, then your program might work. But it's hard to tell since you new the list items and they're not easy to see with breakpoints. So create a new function prototyped as int list_count( NodePtr ); // or int list_count( Node* ); This function takes as input the head of the linked list, and returns the number of items in the linked list. In this function, create a pointer like NodePtr current_item_in_list = NULL; Point current_item_in_list to the head of the list, and then loop it through the list until you find the NULL at the end of the list. Draw a picture of the list to keep track. Increment a counter to keep track of the items in the list. Get the function to work for a list that has 1 or more items in it. Then add code so that if there are NO items in the list (just the head pointing to NULL) that the function returns 0. Finally create a new function prototyped as void display_list( NodePtr ); This function takes as input the head of the linked list, and couts the data in each item of the list separated by a comma. So if the list contains 6 items, calling this function will result in a console display of something like The list contains 5, -1, 3, 6, 8, 7 Get this to work for lists that have one or more items in them (again, use something like current_item_in_list to loop through the list one item at a time, list_count() might also come in handy). Then add code so this function will work if all you have is a head pointing to NULL. In this special case display this: The list is empty After you get the two new functions to work correctly, modify main() to do this: create a zero-item list (just the head) call display_list() call list_count() and display result put one item in the list call display_list() call list_count() and display result put 4 or 5 more items in the list using head_insert() call display_list() call list_count() and display result The modified main(), head_insert(), display_list(), and list_count() functions are what will be in your final submission. 

Reference no: EM13161578

Questions Cloud

Find the vector clocks of all the events : Suppose Process P1 has events e11, e12, e13, e14, e15 e16 e17 P2 has events e21, e22, e23, e24, e25, e26, P3 has events e31, e32, e33, e34, e35 e36 There are message transits from e12 to e22, e24 to e15, e21 to e32, e35 to e25.
The drinking water for the people who live in south dakota : The Ogallala aquifer is the largest in the United States, covering 450,000 across eight states, from South Dakota to Texas. This aquifer provides 82% of the drinking water for the people who live in this region
Can be done with primary keys : Explain what can be done with primary keys to eliminate key ripple effects as a database evolves.
State unique functional groups and number of carbons atoms : Draw the structures of the compounds listed below in groups of isomers and classify them according to their unique functional groups and number of carbons atoms
Write a program that implements the linked list : Write a program that implements the linked list Include the Node struct, the typedef NodePtr statement, and the head_insert() function Then write a main() that does these steps: creates a head for the list.
Explain why limp celery becomes crisp : Explain why limp celery becomes crisp and the skin of your fingertips wrinkles when placed in tap water. (The principle is exactly the same.)
Keyboard combinations that can increase : Microsoft® Word provides keyboard combinations that can increase a user's efficiency. How can these shortcuts simplify the support process for Microsoft® Word
State what is the entropy change if two mole of liquid water : What is the entropy change if two mole of liquid water is heated from 20 C to 100 C under constant pressure? Cp=75.5 J/mol*K over this temperature interval
What is the most likely diagnosis : John is a 26 year old man who begins to notice a progressive enlargement of feet, hands, cranium, nose, and lower jawbone. His doctor recommends irradiation of the pituiatary gland. What is the most likely diagnosis? Why?

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd