Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Joe Elsey
    @joeelsey
    Howdy
    CTownsdin
    @CTownsdin
    hi
    Stephanie Lingwood
    @stephanielingwood
    Hi there
    Hey Hiroshi - you coding this morning?
    Hiroshi Nagata
    @HIROSN
    hi
    Stephanie Lingwood
    @stephanielingwood
    You can join our code party virtually (we're all in the co-working space). So far, we're working on a mix of assignments. Christian and I have the data structures done. Christian, Joe and I have the simple json database done (I did testing, though it has some errors). Joe has the mongo persistence layer done, and is going to work on the Modular JS assignment this morning. Christian and I are tackling the mongo persistence layer assignment.
    What are you working on, Hiroshi?
    Hiroshi Nagata
    @HIROSN
    I'm working on mongo persistence layer
    CTownsdin
    @CTownsdin
    here's some stuff for linked lists... incoming...
    Stephanie Lingwood
    @stephanielingwood
    Cool. That's what Christian and I are workign on. Joe is going to work on linked lists.
    CTownsdin
    @CTownsdin
    // Pair Progammed with Stephanie and Karl ! :)  Go Team
    
    // The Node Class
    function Node (element) {
        this.element = element;
        this.next = null;  // Note!
    }
    // The LList Class
    function LList () {
        this.head = new Node("head");
    }
    LList.prototype.find = function (item) {
        var currNode = this.head;
        while (currNode.element !== item) {  // while (not found)
            currNode = currNode.next;   // keep looking
        }
        return currNode;    // return found item
    };
    LList.prototype.insert = function (newElement, item) {
        var newNode = new Node(newElement);
        var current = this.find(item);
        newNode.next = current.next;
        current.next = newNode;
    };
    LList.prototype.display = function () {
    var currNode = this.head;
    while (currNode.next !== null) {
              console.log(currNode.next.element);
              currNode = currNode.next;
           }
    };
    LList.prototype.findPrevious = function (item) {
    var currNode = this.head;
        while ((currNode.next !== null) &&
                       (currNode.next.element !== item)) {
            currNode = currNode.next;       // keep looking till we find prev
        }
        return currNode;    // return prev
    };
    LList.prototype.remove = function (item) {
        var prevNode = this.findPrevious(item);
        if (prevNode.next !== null) {  // we don't remove items that don't exist!
               prevNode.next = prevNode.next.next;  // move pointer
        }
    };
    LList.prototype.advance = function(item, n) {
        var current = this.find(item);
        var temp = current;
        this.remove(item);
        for (var i = 0; i < n; i++) {
          current = current.next;
        }
        temp.next = current.next;
       current.next = temp;
    };
    LList.prototype.hi = function (name) {
        console.log('hi ' + name);
    }
    
    module.exports = LList;
    
    // var cities = new LList();
    // cities.insert("Con", "head");
    // cities.insert("Rus", "Con");
    // cities.insert("Alm", "Rus");
    // cities.insert("Dom", "Alm");
    // cities.insert("Eve", "Dom");
    // cities.display();
    // console.log('-------\n');
    
    // cities.advance("Alm", 2);
    // cities.display();
    // // console.log('-------\n');
    and now, student grades, #4 Linked List code
    ```
    // Pair Progammed with Stephanie and Karl ! :)  Go Team
    module.exports = function () {
    // The Node Class
    //             "name"
    function Node(element, grade) {
        this.element = element;
        this.grade = grade || 0;
        this.next = null;  // Note!
    }
    // The LList Class
    function LList() {
        this.head = new Node("head");
        this.tail = this.head;
        // this.remove = remove;    :TODO
    }
    LList.prototype.find = function (item) {
        var currNode = this.head;
        while (currNode.element !== item) {  // while (not found)
            currNode = currNode.next;   // keep looking
        }
        return currNode;    // return found item
    };
    LList.prototype.findPrevious = function (item) {
    var currNode = this.head;
        while ((currNode.next !== null) &&
                       (currNode.next.element !== item)) {
            currNode = currNode.next;       // keep looking till we find prev
        }
        return currNode;    // return prev
    };
    LList.prototype.remove = function (item) {
        var prevNode = this.findPrevious(item);
        if (prevNode.next !== null) {
               prevNode.next = prevNode.next.next;  // move pointer
        }
        else {
          this.tail = prevNode;
        }
    };
    LList.prototype.advance = function(item, n) {
        var current = this.find(item);
        var temp = current;
        this.remove(item);
        for (var i = 0; i < n; i++) {
          current = current.next;
        }
        temp.next = current.next;
        current.next = temp;
    };
    // ADD STUDENT FUNCTION
    LList.prototype.addStudent = function (newElement, grade) {
        var newNode = new Node(newElement, grade);
        var current = this.tail;
        newNode.next = current.next;
        current.next = newNode;
        this.tail = newNode;
    };
    // UPDATE GRADE FUNCTION
    LList.prototype.updateGrade = function (student, grade) {
        var currNode = this.head;
        while (currNode.element !== student) {  // while (not found)
            currNode = currNode.next;   // keep looking
        }
        currNode.grade = grade;
        console.log(student + '--' + currNode.grade); // report to teacher
    };
    // SHOW GRADE FUNCTION
    LList.prototype.displayStudent = function(student) {
      //find the node
      var current = this.find(student);
      //show stuff. console log it
      console.log(student + '--' + current.grade);
    };
    // SHOW ALL GRADES FUNCTION
    LList.prototype.displayAll = function () {
    var currNode = this.head;
    while (currNode.next !== null) {
              console.log(currNode.next.element + ' ' + currNode.next.grade);
              currNode = currNode.next;
           }
    };
    
    // Write a program that uses a singly linked list to keep track of a set of test // grades entered interactively into the program.
    
    };
    
    // var classList = new LList();
    // classList.addStudent("Alice", 95);
    // classList.addStudent("Rus", 85);
    // classList.addStudent("Ada");
    // classList.displayAll();
    
    // classList.displayStudent('Rus');
    // classList.updateGrade('Ada', 95);
    ^ Tyler's Repo for
    Create a JSON api with a Mongo Persistence Layer and get it running on Heroku
    Joe Elsey
    @joeelsey
    CTownsdin
    @CTownsdin
    Joe Elsey
    @joeelsey
    shout if you need anything christian.
    CTownsdin
    @CTownsdin
    what's the downstairs door code please?
    just seeking a quiet place to bangout some work
    Chareesa Graham
    @Chareesa
    Hey, did you guys have to do a new pull request on your assignments? I merged my pull requests before Tyler graded and now he wants me to make a new branch --do something-- and do a pull request... I couldn't understand the middle step. Help?
    Stephanie Lingwood
    @stephanielingwood
    Could you just do git pull origin master to your local master, make a new branch from there, make the code changes he asked for (are they in comments in your code on GitHub?), push the branch up, and then do a pull request? Did he want code changes, or just a pull request he could work from, or...?
    Chareesa Graham
    @Chareesa
    Pull request he could work from.
    no changes.. yet