User Tools

Site Tools


journal:fall2019:mgardne8:start

Matt Gardner's fall2019 Journal

of doom


Introduction

  • In this space you can provide a description of yourself,
    • According to Merriam-Webster yourself is described as “that identical one that is you.”
    • However if I had to describe myself instead of yourself;
      • Hi, my name is Matt, I am not an alcoholic my mom just made me come to thi
      • Uhhh… My name is Matt Gardner, I've taken this class before but due to never finishing up my degree I am retaking most of of the Computer Science classes and actually graduate this time.
      • You can find my neglected GitHub page here:
      • You can email here:
      • You can find my non-existent, because i'm lazy and don't like webdev homepage here:
      • Yes, That actually is my email address.
  • your pursuits,
    • A college degree
    • In the future a career involving some sort of data science, hopefully within the machine learning field.
  • your interests.
    • Many things, but to keep the list short, the top 5 things would be:
      1. Machine Learning
      2. Wood Working:
      3. Vegetarian cooking
      4. PC Gaming
        • I may have had an unhealthy addiction to dota2 at one point in the past
        • Currently I mostly play Rouge-Like games, Slay the Spire is the bees knees
      5. Incorrectly counted lists
      6. Oh, also the Python programming language, it's best lang, change my mind.
  • To fill out this section, click the edit button off to the right, delete this placement text, and type your original content.
    • But I like this text, I think i'm going to keep it.

data week12


MONTH Day, YEAR

Filler text- your entry goes here; remove this line to receive full credit.

data week11


NOVEMBER 6, 2019

Something new I learned about this week within C++;

*Range-based for Statement*

Microsoft c++ documentation describes them as follows:

Use the range-based for statement to construct loops that must execute through a “range”, which is defined as anything that you can iterate through—for example, std::vector, or any other C++ Standard Library sequence whose range is defined by a begin() and end().

They are used in the following format:

for ( for-range-declaration : expression ) statement

I am glad to find that there exists something like this within C++ as it is a lot like pythons 'for x in y' and this is something that I love, and made me sad to live without.

I used this recently in an assignment for Han's c++ class in conjunction with vectors as follows:

      for( vector<int> v : vect )
      {
              total = accumulate( v.begin(), v.end(), total );
              count = count + v.size();
      }

This allowed me to iterate over all the objects within a vector of vectors that contain ints, summing them up and counting the number of elements. (To calculate an average).

This has the added benefit of 'just working' even when all the vectors within the main vector vary in size.

Additionally I nested these style of for loops to create a compact and efficient way of outputting the data for the project.

      for( string name : names )
      {
              cout   << endl << name << endl << "    Grades: ";
              for( int grade : grades.at(i) )
                      cout   << grade << " ";
              cout   << endl << "    Average: " << average(grades.at(i));
              cout   << endl << "    LetterG: " << get_let(avgs.at(i)) << endl;
              i++;
       }

data week10


OCTOBER 30, 2019

Stacks on Stacks on Stacks Oh, the other type of stacks, right.

It's stack time, we're getting to the fun data structures.

Stacks:

A stack is a First-in-last-out (FILO) data structure, this means that the most recent thing you put into the structure, is the only thing you can get out of it.

At their core, stacks only have two functions, Push(ing) and Pop(ing), and a single pointer to the top of the stack

Pushing an object to the stack will place it on the top of the pile, while poping an object will remove the top object of the stack.

For example, we could preform the following operations and have a stack as follows:

//What follows is a wonderful blend of pseudocode, C, and Python, enjoy!
Stack Mystack
Mystack = mkstack()
    // Mystack -> 
Mystack.push(7)
    // Mystack -> 7
Mystack.push(99)
    // Mystack -> 99 -> 7
    // Notice how 99 is now the top object of the stack.
tmp = Mystack.pop()
    // Mystack -> 7
    // tmp = 99
    // Pop retrieved the top object from the list
Mystack.push(-10)
    // Mystack -> -10 -> 7
    // tmp = 99
Mystack.push(35)
    // Mystack -> 35 -> -10 -> 7
    // tmp = 99
Mystack.push(188)
    // Mystack -> 188 -> 35 -> -10 -> 7
    // tmp = 99
tmp = Mystack.pop()
    // Mystack -> 35 -> -10 -> 7
    // tmp = 188;

Additionally many stack implementations include the following optional functions:

Peek - This function will return the [value(s)/pointer/a copy depending on implementation] of the top object without removing it from the stack.

IsEmpty - This function will return a Boolean value stating if the stack is empty

IsFull - This function will return a Boolean value stating if the stack is full, only applicable to a bounded stack.

A bounded stack? A bounded stack is just a stack with a maximum size, and if you try to push more objects than it will support it will (in theory) prevent the operation.

Next week, Queues! que? is the second ue silent? does that mean t queueueueue would be pronunced the same as queue? Such a strange word.

"You are a blasphemous heathen if you support LIFO over FILO."
  --Abraham Lincoln (Abraham Lincoln's Programming Idioms for Noobs (Play), act IV, scene II)

data week9


MONTH Day, YEAR

Filler text- your entry goes here; remove this line to receive full credit.

data week8


MONTH Day, YEAR

Filler text- your entry goes here; remove this line to receive full credit.

data break1


MONTH Day, YEAR

Filler text- your entry goes here; remove this line to receive full credit.

data week7


MONTH Day, YEAR

Filler text- your entry goes here; remove this line to receive full credit.

data week6


MONTH Day, YEAR

Filler text- your entry goes here; remove this line to receive full credit.

data week5

SEPTEMBER 18, 2019

Filler text- your entry goes here; remove this line to receive full credit.

WDIDTW

What Did I Do This Week?

  1. PCT4.

Yes, that's it, I'm sorry.

Future improvements

This is going to be a running list of improvements I plan to make in the future, if our projects allows.

  1. Improve setpos function
    1. depends on dll implementation.
    2. instead of iterating from the start of the list, instead determin if it's more efficient to start at the front or the end of the list
    3. contingent on if our list implementation will also track the running size of our list, otherwise may not be a fesible optimization if we have to parse the list to get it's length.
  2. Implement a more efficient sorting function
    1. bubblesort is an easy impelmentation
    2. Quicksort looks fun, and realtivly simple to implement, I will most likely attempt this.
    3. Recursive Bubble sort looks like a neat way to have a tiny tiny solution

On sorting

What sorting methods exist, what ones fit our use case, and are they efficiently implemented?

Bubble sort

Bubble sort sorts a list simply by iterating through it's elements (nodes) and switching them if the first node is larger than the second (or the inverse depending on what direction you are sorting) Best: O(n^2) Worst: O(n^2) Pros: Simple, can be implemented in less than 10 lines. Cons: Always O(n^2) regardless of order of list, even if it's already sorted.

Modified Bubble sort

Bubble sort containing a flag that is modified when a change is made, if no change is made (list is sorted!) don't do more loops. best: O(n) Worst: O(n^2) Pros: Stops as soon as the list is sorted Cons: worst case still O(n^2)

Selection Sort

sets an index to the first object, moves the smallest object to that position, then moves to the next position and finds the next smallest, <this continutes until the list is sorted> Best: O(n^2) Worst: O(n^2) Pros: size of iterations shrink as list is sorted Cons: always o(n^2) regardless of order of list, even if it's already sorted. (same as bubble sort)

Quick Sort

Quicksort divides and conquer's a list elements while sorting.

  1. A node within the list list is chosen, this is the pivot
  2. all elements lower are placed on left side of the pivot, and larger elements are placed on the right. (in no order) (similar elements can be placed on either side)
    1. At this point, the pivot is in it's correct location
  3. the list on each side of the pivot, (up to, but not including the pivot) is then recurivly sent to it's own quicksort
    1. A list of zero or one nodes is considered sorted

Best: O(n*log(n)) Worst:O(n^2) Pros: very quick to sort a list assuming it's not in it's worst case state. (reverse sorted) Cons: A bit more complex to implement.

data week4


MONTH Day, YEAR

Filler text- your entry goes here; remove this line to receive full credit.

data week3


September 4, 2019

This week I submitted SLN0 and SLN1.

Matt enabled SLL0 and SLL1 for me to work on.

I later finished SLL0.

PCT projects are still horrible things, confirmed that these don't end.

Discussed the possibility of creating a program that solves the PCT projects logically, this is most likely something I'll work on in the future in Python, I have a good idea for how I will implement this. (To be discussed in a later post)

In SLL1, everything has been finished and is in working order other than the compare function. The only solution I had to solving this problem was way though, and after asking for a bit of direction and doing a bit of reading I have a good idea how I may take this later in the week.

SLL1 also reminded me that I need to refresh and improve upon my bitwise operations, they are something I feel I never fully grasped.

data week2


MONTH Day, YEAR

Filler text- your entry goes here; remove this line to receive full credit.

data week 1

August 20/21, 2019


Portfolio

Please note that these are old and may not be current or even correct at this point.


journal/fall2019/mgardne8/start.txt · Last modified: 2019/08/17 09:01 (external edit)