Write a function to make a new list

Assignment Help C/C++ Programming
Reference no: EM131681857

Project -

In your project you will implement singly linked lists in C. You will test your program by creating an ordered linked list of integers. You will then use your implementation to write a program that creates a representation of a deck of cards and makes a random shuffle of the deck. The algorithms for implementing linked lists will be discussed in your classes.

Therefore, this description does not list implementation details of the required functions.

Detailed requirements for linked lists implementation:

You will need to write several functions.

0. To represent a node in a linked list you can use a structure

typedef struct Node f

SomeDataType data;

struct Node *next;

} ListNode;

where SomeDataType can be any C data type.

1. Write a function to make a new list. Your function should create a dummy head node to represent an empty list.

ListNode *newList(void) // returns a head of a new empty list

2. Write functions to insert elements into a list and to remove elements from a list ListNode *removeNode(ListNode * prev); // removes the node after prev

ListNode *insertNode(ListNode *prev, SomeDataType data)

// inserts a new node with data field data after prev

3. Write functions to count the number of elements in a list without the head and to print the list

int length(ListNode *head) // number of elements in the list

void printList(ListNode *head) // print the data fields for the entire list

Note that printList will print the linked list implemented to support the second part of your project.

To test your code you will use it to make an ordered list of random integers. After that you will write functions to manipulate a deck of cards. You should assume that a full deck contains 52 cards: card values (A,2,3,4,5,6,7,8,9,10,J,Q,K) in four suits (Spades,Diamonds,Hearts,Clubs).

You can use either integers or enums to represent cards and suits, but you should print card values using their symbols ('A','2',. . . ,'10','J','Q','K') and the suits using first letter of their name. Examples: (10,S),(A,C),(7,D) to stand for 10 of spades, ace of clubs, and 7 of diamonds.

Detailed instructions for ordered list of integers implementation:

To test your linked list code you should generate 10 random numbers in the range [0..1000] and insert them in a ascending order into an empty list. Every time you generate a number you need to traverse the linked list and find a proper place for the number to be inserted. This means that you should not sort numbers before insertion. You should calculate the list length and print it together with the list after each number insertion. Note that for this part to work your data field should be of type int.

Attachment:- Assignment Files.rar

Reference no: EM131681857

Questions Cloud

What is strategic consulting : What is Strategic consulting? What are the best practices for consulting?
Discuss information systems contributed to the healthcare : How have healthcare technologies and information systems contributed to the healthcare in the United States
How would the criminal justice system be different : How would the criminal justice system be different today if the founding fathers had decided not to create a separate system of federal courts.
Consumer behavior-blamed for promoting materialistic society : Advertisers are often blamed for promoting a materialistic society by making their products as desirable as possible.
Write a function to make a new list : CS 262 Project. Write a function to make a new list. Your function should create a dummy head node to represent an empty list
Discuss systems and processes related to new technologies : What are some ways to get physicians to utilize new systems/processes related to new technologies
Identify three of the most successful companies : Identify three of the most successful companies or organizations today, in your opinion.
How would you reduce the federal court caseload : How would you reduce the federal court caseload? In considering where you would reduce federal court jurisdiction, also consider where you might increase it.
What is your solution to the mind-body problem : The crucial question in Dualism is how does the non-material Mind interact with the Material Body. What is your solution to the Mind-Body Problem?

Reviews

len1681857

10/16/2017 4:38:02 AM

Topic: Project 2 in C language. Detailed Question: Teacher's comment: You should always call srandom() in a program (lab, project, video poker machine) that uses random()! Now whether you seed it with a specific value (preferred for labs and projects) or using time(), Your makefile should contain a way to compile both executables with only the "make" or "make all" command. runs it using valgrind. valgrind shows no issues with memory management. The code is commented and indented appropriately, and contains no questionable coding practices. You may NOT use realloc

len1681857

10/16/2017 4:37:56 AM

The teacher doesn't want to use more tools without their teaching, so plz use #include stdio.h #include stdlib.h look at the linklist example to know teacher's style and algorithms for implementing linked lists. They will post the grading details at the last week. If we do well, we will match with the details. If not, could you please fix to get the best grade?

len1681857

10/16/2017 4:37:09 AM

Use script do show your session in which you compile and run your code for various values of n. You should show testing of your functions. You should show the results for both the ordered list of integers and the deck of cards manipulation. Use tar or zip command to create an archive of your script file, your fully commented source code, and your Makefile. All filenames should use the standard naming conventions that were used in the labs. Submit your tar or zip file on Blackboard.

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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