Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ ONLY: I'm having an issue with my sort function. Every time I run it, it has a segmentation fault and core dumps. Everything else

C++ ONLY: I'm having an issue with my sort function. Every time I run it, it has a segmentation fault and core dumps. Everything else works.

image text in transcribed

here's my current sorting functions:

image text in transcribed

here's a copy of the main.cpp:

image text in transcribed

CS 101 Spring 2018 Project 2 Due 3/7 For this assignment you will build a doubly linked list class. The name of your class is dList, and each entry in the linked list should store 2 different values, a key (integer) and a type (character). A struct (or class) defining the nodes of the linked list should appear outside of the dList class definition and should be named "node". The class should support the following operations: Default constructor. Should create an empty list Constructor where the first two parameters are arrays and the third is the length of the arrays. The constructor should initialize the list with the contents of the arra dList(intl, char[l,int) void addFront(int, char) Creates a new node at the front of the list void addBack(int, char) Creates a new node at the back of the list node "search(int) Searches the list for the occurrence of the int parameter in the list and returns a pointer to the node containing that ke Outputs all keys that have the type equal to the character parameter. Should start at the front of the list and output the keys in list order void find(char) void moveFront(nodeMoves the node pointed to by the parameter to the front of the void moveBack(node Moves the node pointed to by the parameter to the back of the void out(int, char =) | Outputs the first k elements of the list, where k is the int list list parameter. The char parameter can be either 'f' or 'b,'f' is the default value. If the char is f' the output starts at the front of the list. If the char is 'b', start at the end of the list and work backwards Should perform a O(n lg n) time sorting algorithm on the items in the list. The list should be in increasing order based on the integer key after this operation void sort() You should be careful to manage your memory and implement a destructor, but it is not required to implement a copy constructor or assignment operator for the class. You may use dummy header and tail nodes if you want. Your code should be in a file named dList.cpp and the sample main below should compile and work without modification. You are not allowed any include files in dList.cpp, notice that the main function will include iostream before the dList.cpp file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago