Write a very basic doubly-linked list

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

Linked Lists 

Along with vectors, linked lists are one of the fundamental data structures in computer science. Unlike vectors, which store information in a contiguous block of computer memory, linked lists have the potential to store information in non-adjacent memory blocks. In this lab, you will write a very basic doubly-linked list. To complete this lab, you will need to have created the appropriate .h and .c files that

implement the following struct and functions: 

typedef struct IntList_t 

 int value; 

 struct IntList_t *previous; 

 struct IntList_t *next; 

} IntList_t; 

 

IntList_t* intList_init(int starting_value) 

Like our vector's init function, the LL version must dynamically create a new IntList_t and set its starting value as well as setting the previous and next pointers to NULL. 

IntList_t * intList_rewind(IntList_t *some_list) 

This function returns a pointer to the "beginning" of the linked list. For our purposes, we will consider the beginning of a linked list to be represented by the IntList_t whose previous pointer is equal to NULL. 

void intList_add(IntList_t *some_list, int value) 

This function will add a new IntList_t to the end of the current linked list. Note that for our purposes, the last element in the list is represented by the individual IntList_t whose next pointer is equal to NULL. 

void intList_remove(IntList_t *some_list) 

This function removes the supplied IntList_t from the current chain of list items. 

void intList_free(IntList_t *some_list) 

Freeing up dynamic memory allocated for a linked list is a little more work than freeing up dynamic memory for a vector. As such, this function should call free on every node in the linked list. 

Sample Output 

To test these methods, you must write a simple test driver in your main function. Here is an example of my test driver:  

2065_sample_output.png

Reference no: EM1379691

Questions Cloud

Determine a source code control system : Determine a source code control system and discuss why is such a system necessary when multiple programmers build a program or system?
Describe the concept of a signal : Assume when a child process is forked, a parent may wait for the successful completion of the child via the wait service so that return result of that application can be read from the procedure descriptor block.
Discuss mitigation strategies : It is determined that 3-out of 5-businesses that experience downtime of forty-eight hours or more will be out of business within three years.
Overview of multiprogramming mode : Member of coordinating a computer's activities is handling failure. This is called fault tolerance. Briefly explain about how a computer handles loss of power to limit the loss of all work
Write a very basic doubly-linked list : CptS 122 Lab #2: Linked Lists ,  Along with vectors, linked lists are one of the fundamental data structures in computer science. Unlike vectors, which store information in a contiguous block of computer memory, linked lists have the potential to sto..
Compute the net expected value for the project : You are considering to make modifications to an existing application. Compute the net expected value for the project risks and opportunities
Enable multimedia on a website : Few multimedia can be hard to watch on a mobile device due to screen size or bandwidth limitations. Determine two articles that discuss considerations and new developments that will enable multimedia on a site
Circuit switch and packet switch environment : Provide two examples of a circuit switch and packet switch environment. Base one example on a circuit switch and the other on a packet switch.
Determine the largest value : A soft real time system has 4-periodic events with periods of 50, 100, 200 and 250 msec each. Assume 4-events need 35, 20, 10 and X msec of CPU time, respectively.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create a program for a company named retail-mart

Prompt the user to enter an item name (one word only), a quantity and a price. For this step, in addition to functionality, I'll be looking at: location of the variable declarations; appropriateness of data types selected; appropriateness of the va..

  Write a bouncing ball video game

The balls bounces within the screen where the two horizontal walls are fixed

  Design customized mailing lists for marketing department

Marketing department requires to be able to design customized mailing lists, to send different messages to different types of donors. What system will best meet these requirements?

  Implement method to advance any given date by one day

Write C++ implementation of this method. Create and specify any other methods that you require. Include comments which will be helpful to someone who will maintain implementation in the future.

  Program to print out invalid number to character

The integer must contain 3 distinct non-zero number, or the program will print out invalid number.it should print out invalid query.

  Implement database having array of pointers

One way to implement this database is to have an array of pointers pointing to Employee objects. You will obviously require a function named Calculate_salary() which will be different for each employee class. Write code in c++

  C program to randomly generate more than ten ip address

Write C or C++ program which Randomly generates more than 10 IP addresses written in decimal format and write results in text file (e.g. Dec_IPAddresses.txt)

  Create class having constructor to recieve two ints

Create a class (in C++)named Card. The class should have two int data members named face and suit.The class should have a constructor that recieves the two ints and uses them to initialize the data members.

  Write program in c to calculate diameter-compression load

Write a program in C to calculate diameter in centimeters of steel rod, an aluminum rod, and a copper rod, which can withstand a particular compression load.

  Programmingto compute the volume of water in the cubic feet

Write down an algorithm (Programming in C) in order to compute the volume of water in the cubic feet, flowing through a pipe of diameter d in feet, having a velocity of v feet per second.

  Design a simple game of blackjack

Prepare a simple game of blackjack using object oriented programming.

  Using opengl to create a cube

Write a program in C/C++ using OpenGL to create (without using built in function) a cube by implementing translation algorithm by translating along 1. X-axis, 2.Y-axis and 3. X and Y plane

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