Code Monkey home page Code Monkey logo

lab7-ari's Introduction

COMP 271 002 F17 Lab 5 (Week 7)

Team project

Work in teams of two.

Objectives

An understanding of the following concepts and techniques:

  • ADT implementation perspective
  • stack ADT
  • dynamically allocated objects
  • implementing stack as linked list
  • algorithms based on the stack's LIFO policy
  • interface-based testing

Instructions

In this lab, you will have the opportunity to implement a generic stack as a linked list and use this implementation to solve a simple problem.

Specifically:

  1. Complete the TODO items in the LinkedStack implementation until the tests pass.
  2. Complete the main class ReverseLines, which reads successive input lines until EOF and then prints themin reverse order, using a suitable stack instance.
  3. Answer the following questions:
    • Why does LinkedStack not require an explicit constructor?
    • What is the time and (extra) space complexity of each of the LinkedStack methods, as well as ReverseLines.main?
    • How else (not using Node) could we have implemented LinkedStack in such a way that it is still based on a linked list but the asList method uses constant time and space?
    • Is it better for push and pop to return the item or the stack itself? Briefly discuss the pros and cons of each design.

Grading

  • 1 submission via GitHub
  • 2 completion of items marked TODO in LinkedStack and tests passing
  • 1 completion of ReverseLines and correct behavior
  • 1 written part
    • 0.8 responses to the questions above
    • 0.2 grammar, style, formatting

5 points TOTAL

lab7-ari's People

Contributors

klaeufer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.