Create a doubly linked list

Assignment Help Data Structure & Algorithms
Reference no: EM132276377

Question: A) From your Singular Linked List,

Create a Doubly Linked List.

Use this to create a Sorted Linked List,

Use this to create a prioritized list by use. Bring to front those links recently queried.

Code c++

main.cpp

//System Libraries

#include <cstdlib> //Random Function cstdlib

#include <iostream> //I/O Stream iostream

#include <ctime> //Time Function setting random seed ctime

using namespace std;

//User Libraries

#include "Node.h"

//Global Constants

//Physics/Math/Conversions/2+ArrayDimenstions

//No Global Variables

//Function Prototypes Here

Node *filNode(int);

void prtNode(Node *);

void destroy(Node *);

//Execution Begins with Main

int main(int argc, char** argv) {

//Random Number seed set once here

srand(static_cast<unsigned int>(time(0)));

//Declare and initialize variables

Node *head=filNode(10);

//Display results here

prtNode(head);

//Clean up code

destroy(head);

//Exit stage right

return 0;

}

Node *filNode(int n){

//Initialize the front

Node *head=new Node;

head->data=n--;

head->ptr=NULL;

Node *tail=head;

//Loop until filled

do{

Node *next=new Node;

next->data=n--;

next->ptr=NULL;

tail->ptr=next;

tail=next;

}while(n>=0);

return head;

}

void prtNode(Node *head){

Node *temp=head;

do{

cout<<temp->data<<endl;

temp=temp->ptr;

}while(temp!=NULL);

}

void destroy(Node *head){

Node *temp=head;

do{

temp=temp->ptr;

delete head;

head=temp;

}while(temp!=NULL);

}

Node.h

#ifndef NODE_H

#define NODE_H

struct Node{

int data;

Node *ptr;

};

#endif /* NODE_H */

Reference no: EM132276377

Questions Cloud

Compare the role and function of the federal court system : The structures of these court systems are very similar in that they are broken up into multiple levels to handle both criminal and civil matters.
Impact of various personality types within the workplace : Impact of various personality types within the workplace - determine leadership qualities and best placement in an organization
Essay on philosophy of leadership and application : Organisational Behaviour and Leadership - Assessment – Individual essay - Demonstrate a critical understanding of organisational behaviour
What decisions did the fbi and saic make : What decisions did the FBI and SAIC make during development that increased risk? How can these be avoided in the next project that the FBI takes on?
Create a doubly linked list : From your Singular Linked List. Create a Doubly Linked List. Use this to create a prioritized list by use. Bring to front those links recently queried.
Discussion of key elements of the model of stewardship : Review the models of stewardship presented by Wilson (2016) and Block (1993) - analyse the potential benefits and challenges that might occur upon employing
Write your implementation in a module you will name : Define, directly in the interactive shell, function perimeter() that takes, as input, the radius of a circle (a nonnegative number) and returns the perimeter.
What do you see as the benefits of such an effort : Discuss why a company would want to go through the expense and effort to develop a Data Warehouse environment. What do you see as the benefits.
Disucss the term managing information systems : This capstone course will require a BEST PRACTICES PRESENTATION which will consist of a PowerPoint presentation. The project presentation will be a detailed.

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