Notes, summaries, assignments, exams, and exercises for Computer science for Other courses

Data Structures: Linked Lists, Trees, Stacks and Java Code Examples

Computer science3.06 KB

Code to Add the First Element to a Tree Structure

public void insertFirstNode(Object item) {
    // If the tree is empty, the new node becomes the root of the tree
    if (theRoot == null) {
        Node theNewNode = new Node(item);
        theRoot = theNewNode;
    }
}

Code to Delete an Element in a Linked List

public void remove(int index) {
    // Special case of removing at the head of the list
    if (index == 1) {
        head = head.getNext();
    } else {
        // Find the previous and current node
        setCurrent(index);
        prev.setNext(curr.getNext());
    }
    size = size - 1;
}

Steps to Insert an Element into a Linked List

  1. Step 1: Set curr to the node at the position you want to insert.
  2. Step 2: Create a new node. Set prev and
...
Continue reading "Data Structures: Linked Lists, Trees, Stacks and Java Code Examples" »

Refer to the exhibit. Which path will traffic from the 172.16.1.0/24 network take to get to the 10.0.0.0/24 network?

Computer science659.28 KB

Autouzupełnianie poleceń w bashu

Kategoria: Bash, Ubuntu / Tag: Bash, debian, Linux, Ubuntu / Dodaj komentarz

Wiadomo, że dużym ułatwieniem przy pracy w linuksowej konsoli jest klawisz .
Podwójne wciśnięcie listuje dostępne ścieżki a pojedyncze je uzupełnia oszczędzając nam wpisywania wszystkiego z palca.

Można jednak tą funkcjonalność znacznie rozszerzyć tak aby  uzupełniał nam również parametry i komendy konsolowych programów. Na przykład wystarczy wpisać: aptitude i i raz wcisnąć  a bash automatycznie uzupełni komendę do: aptitude install

Aby mieć tak przyjaznego basha należy zainstalować pakiet bash-completion:

aptitudeinstall bash-...

Continue reading "Refer to the exhibit. Which path will traffic from the 172.16.1.0/24 network take to get to the 10.0.0.0/24 network?" »

10 Good Deeds of Web Design and Object-Oriented Design Principles

Computer science3.23 KB

10 Good Deeds in Website Design

  1. Place the organization name and logo on every page and make the logo a link to the home page.
  2. Provide a search function if the site has more than 100 pages.
  3. Write straightforward and simple headings and page titles that explain the content.
  4. Structure the page to facilitate reader scanning.
  5. Instead of cramming everything about a product, use hypertext to structure the content.

3 Broad Aspects of Web Design

  1. Designing for the computer medium
  2. Designing for the whole site
  3. Designing for the user

3 Design Patterns

  1. SINGLETON: Ensures that only one object of a given class is created.
  2. ADAPTER: An example of the indirection design principle (like an electrical adapter).
  3. OBSERVER: Allows two objects to be linked dynamically.

Statechart

Used...

Continue reading "10 Good Deeds of Web Design and Object-Oriented Design Principles" »