Skip to content

Commit

Permalink
start of CS162, linked List
Browse files Browse the repository at this point in the history
  • Loading branch information
gigatexal committed Jun 21, 2016
1 parent a0824c3 commit 349a6a0
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added cs162/project1/a.out
Binary file not shown.
33 changes: 33 additions & 0 deletions cs162/project1/project1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* compile via g++ -o proj1 project1.cpp */
#include <iostream>
#include <string>
using namespace std;

/* singly linked list */
struct Node {
string item;
float cost;
int qty;
Node *next;
};

int main(){
Node head;
Node n;
n.item = "TEST";
n.cost = 999.99;
n.qty = 2;

head.next = &n;

Node currNode;
Node nextNode;
currNode = *head.next;
currNode.next = &nextNode;

cout << currNode.item << endl;

cout << (head.next++)->item << endl;
cout << (head.next->next++)->item << endl;
return 0;
}
Binary file added nuitka/.test_py_raw.py.swp
Binary file not shown.
28 changes: 28 additions & 0 deletions nuitka/test_py_raw.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import time

import random

def gen_random_int(start = 1,limit=100000):
nums = (random.randint(start,limit) for x in range(limit))
return nums


def sum_nums(gen_nums):
total = 0
for num in gen_nums:
total += num

return total



def main():
curr_time = time.clock()
nums = gen_random_int(1,1000000)
total = sum_nums(nums)
end_time = time.clock()
print ("time taken: ", end_time - curr_time, " value was: ",total)



main()

0 comments on commit 349a6a0

Please sign in to comment.