Implement and use a linked list data structure

Assignment Help Data Structure & Algorithms
Reference no: EM133669755

Data Structures

Purpose: To measure the student's ability to implement and/or use a linked list structure to solve an underlying problem in C++.

Overview
This assignment will test your ability to implement and use a linked list data structure to implement a (simulated) web browser. This browser will allow users to visit and navigate a history of websites visited, along with maintain a list of bookmarked favourite sites, using a linked list.

You will be provided with a main program that includes a menu and prompt to control and test your implementation. Additionally, the main program will be able to run a list of commands from a file. You will also be provided with appropriate header files and a makefile, leaving you to implement only the Node, LinkedList, and Browser classes.

The Supplied Files
This section gives an overview of the files that you are provided as part of this assignment. There are quite a few, so you are recommended to take some time to understand the overall structure of the program.

main.cpp - contains the main function and other functions that allow you to interactively test the functions you implement in playlist. This file should not be modified.
node.h - contains the header for the Node class, which includes the instance variables and behaviours that your node should contain. This file should not be modified.

node.hpp - contains (skeleton) template implementations for the Node class. This is where your implementation of the node is to be completed. This file should be modified and be part of your submission.

linked_list.h - contains the header for the LinkedList class, which includes the instance variables and behaviours that your linked list should contain. This file should not be modified.

linked_list.hpp - contains (skeleton) template implementations for the LinkedList class. This is where your implementation of the linked list is to be completed. This file should be modified and be part of your submission.

browser.h - contains the header for the Browser class, which includes the instance variables and behaviours that your browser should contain. This file should not be modified.

browser.cpp - contains (skeleton) implementations for the Browser class. This is where your implementation of the browser is to be completed. This file should be modified and be part of your submission.
makefile - the makefile for the project, which outlines the build recipe. The -g flag is set for you to make debugging and/or memory leak detection more convenient, should you wish to use these tools. This file should not be modified.

TestCommands.txt - a text file containing a sequence of commands that can be used to run the program in file mode. This is simply a text file with valid commands, one per line. This file is not really part of the program so you may modify if you wish.

Running the Program
Of course, you will need to ensure the program is compiled prior to running it. You can use the supplied makefile for this - it will produce an executable called Browser.
Note: while the initial code you have been supplied will compile, it will produce a compiler warning (see Figure 1). In this case, the warning is indicating that we have a method expecting a reference to be returned, but we have not returned anything. In fact, all the methods you are meant to implement are either empty or return default values - you are provided only with a skeleton of the final program and are expected to complete the required implementations.

The program will operate in two different modes: prompt (interactive) mode and file mode, each described below. In prompt mode, the user is presented with a prompt to enter commands in sequence. In file mode, the user can supply a text file, which contains a list of commands that will be executed - this can be used to test a particular sequence of commands without having to type them every time.
Important Notes: The program does not validate web addresses. The program is also not equipped to handle spaces in the web address provided. Rather, the program interprets spaces as the separator character between different command arguments. If you wish to supply your own data, ensure that you do not include spaces in web addresses.

Prompt (Interactive) Mode
To run in prompt mode, the program should be executed as normal using the command:

./Browser

When the program is first run, you will be presented with a welcome message and a prompt. The prompt will allow you to enter commands to interact with your browser. Initially, the program will run, but not successfully given that you will not have implemented the functionality. However, you are recommended to have a look through the code, particularly the header files, to better understand the requirements for the various methods you must write.

Figure 2 shows the list of commands that the program can interpret and execute. The parsing and execution of these commands is handled in the main file. Thus, your concern is only to implement the underlying functionality to provide the intended behaviour.

Figure 3 shows an example of the program operating in prompt mode, where the user has entered the commands listed after the prompts Enter Command:.

File Mode
To run in file mode, the program will be executed with an argument containing the name of the file. To run in file mode, the program will be executed as:

./Browser TestCommands.txt

The list of commands in the supplied TestCommands.txt is minimal and does not run an exhaustive set of tests. However, you may supply the path to any text file as the argument. In fact, you are encouraged to develop your own set of tests, which may be easiest to do with a preset list of commands in a text file.
Note: Executing the program in file mode should produce the exact same output as running the corresponding commands, in sequence, in prompt mode.

Figure 4 shows an example of the program operating in file mode, where the user has supplied the default TestCommands.txt file. Note: this figure does not show the entirety of the output, only a sample.

The Tasks
Your tasks can be summarised as the implementation of three classes, namely Node, LinkedList, and Browser. For each class, you are provided with the header file and skeleton implementations (i.e., method stubs that allow the program to compile, but are otherwise non-

functional). You are not permitted to change the supplied header files and must implement all methods listed in the header files, irrespective of whether they are used in the program.

Node
The Node class is a templated version of a node object and should be implemented as discussed in the lectures. For a full list of methods required and some important details, you should examine the node.h file and its associated documentation.

LinkedList
The LinkedList class is a templated version of a doubly linked list using two sentinel nodes and should be implemented as discussed in the lectures. For a full list of methods required and some important details, you should examine the linked_list.h file and its associated documentation.

Browser

The Browser class contains the main logic of the browser and uses your LinkedList class to supply the underlying functionality. That is, this class must use the public interface provided by your LinkedList class to perform the various operations that support the list of commands given in Figure 2. You are not permitted to use std::list or any other collection in the std namespace. For a full list of methods required and some important details, you should examine the browser.h file and its associated documentation.

Reference no: EM133669755

Questions Cloud

Consider the larger context of social engineering : We've focused on social engineering with individuals by individuals, but it's important to consider the larger context of social engineering
Which adolescents relate to one another socially : In what ways do you think social media has affected the ways in which adolescents relate to one another socially?
Briefly explain the social structure theory. : Briefly explain the social structure theory. What areas in this chapter can you directly relate back to the Reyes-Canales case?
Many came to work for low wages women worked for low wages : Population increased a lot with about 20 million immigrants that moved to America for opportunity. Many came to work for low wages Women worked for low wages
Implement and use a linked list data structure : SENG1120 Data Structures, University of Newcastle - To measure the student's ability to implement and/or use a linked list structure to solve an underlying
What is your biological history : What is your biological history? Is there anything relevant here that would increase a counselor's understanding of you as a person?
Gestalt is rooted in which philosophical underpinnings? : Gestalt polarities. From reading Gestalt, we learn that Gestalt is rooted in which philosophical underpinnings?
Explore the blockchain eco-system : Blockchain Fundamentals - Critically evaluate security and regulatory frameworks and Design and document a blockchain solution to an existing practical problem
What approaches you would take to help them feel welcome : Describe what you would do or what approaches you would take to help them feel welcome

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Compare the total cost of each layout predicted by craft

Consider the initial layout pictured in Figure and the two from-to charts giving the flow and cost data. Use the CRAFT approach to obtain a final layout.

  Write a bubble sort algorithm that is appropriate for list

Write a bubble sort algorithm that is appropriate for a linked list.

  Why can not a binary search be applied on the given list

Why can't a binary search be applied on the list below? In separate chaining, the keys that map to the same hash value are stored in a _____. When designing a hash function, we try to _____ the number of collisions.

  Describe a lineartime algorithm for turning T into a priorit

Let S be a set of n points in the plane with distinct integer xand y- coordinates. Describe a lineartime algorithm for turning T into a priority search tree.

  Draw five-vertex connected graph g that has no cut-vertices

Draw a 5-vertex connected graph G that has no cut-vertices, and then verify that G satisfies each of the following properties. Prove or disprove: If a simple graph G has no cut-edge, then every vertex pf G has even degree?

  Identifying flaws in the design

Identify flaws in design of the Report of Consumers that follows. What assumptions about users and tasks did you make in order to assess this design?

  Find the first occurrence in t of a string s

Given a long text string T, one shorter pattern string s, and an integer k, find the first occurrence in T of a string (if any) s such that dH(s, s ) ≤ k. What is the complexity of your algorithm?

  Suppose n gt 1 is a natural number and f z rarrn upsilon 0

suppose n gt 1 is a natural number and f z rarrn upsilon 0 is the function that associates with each a epsilon z its

  Write an algorithm to delete all the leaves from binary tree

Write an algorithm to delete all the leaves from a binary tree, leaving the root and intermediate nodes in place. (Hint: Use a preorder traversal.)

  Determine the set ecr for chang-roberts algorithm

Give an initial configuration for Algorithm 7. 7 for which the algorithm actually requires llog NJ + 1 rounds. Determine the set ECR (as defined before Lemma 7. 1 0) for the Chang-Roberts algorithm.

  Does every vertex in a rooted tree have a parent

Prove that a vertex in a rooted tree can have at most one parent. Does every vertex in a rooted tree have a parent?

  Identifying the location of rubric objectives

Code Comments are used to identify the location of rubric objectives, Code Formatting is used to raise the readability of the HTML Code.

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