avatar
Articles
57
Tags
48
Categories
11

Home
Archives
Tags
Categories
About
Oscar-Ge
Home
Archives
Tags
Categories
About

Oscar-Ge

cpp-containers-iterators
Created2024-06-12|CS106L
containerAn object that allows us to collect other objects together and interact with them in some way. (vectors, stacks, queues!)why containers? organization standardization abstractionwe have used the idea for structs:12345678910struct Student {string name; // these are called fieldsstring state; // separate these by semicolonsint age;};Student s;s.name = "Fabio";s.state = "FL";s.age = 21; // use . to access fields what if there are a whole class of students?Typi ...
Cpp-types, structs, ini, ref, streams
Created2024-06-08|CS106L
very basic STL12345#include <iostream>int main() {std::cout << "Hello, world!" << std::endl;return 0;} std:::The STL Tons of general functionality Built in classes like maps, sets, vectors Accessed through the namespace std:: Extremely powerful and well-maintainedusing namespace std; is not a good style! typesmore fundemental types: std::string str = "Haven";C++: a interpreted language (Types before program runs during compilation)C++ allows func ...
61C-P3-RISC-v
Created2024-05-28|CS 61C
Assembly languagedefinition Different CPUs implement different sets of instructions.  The set of instructions a particular CPU implements is an Instruction Set Architecture (ISA), and the programming language defined by the ISA is commonly known as an assembly language. Examples: ARM (cell phones), Intel x86 (i9, i7, i5, i3), IBM/Motorola PowerPC (old Macs), MIPS, RISC-V, … risc-vCS 61C Reference Card https://cs61c.org/sp24/pdfs/resources/reference-card.pdf Lists out the entire base arc ...
61C-P2-number
Created2024-05-23|CS 61C
binarybasics A system of storing data using just two digits: 1 and 0. Everything in a computer is ultimately stored in binary (high voltage wire = 1, low voltage wire = 0) Generally rooted in the mathematical concept of binary (as a base 2 system of representing numbers) Since computers tend to “think” in binary, it is ultimately useful to work with values in binary. By convention we prepend any binary value with “0b” operations&, |, ~, ^: convert every<<, >>: Left s ...
61C-P0-debug
Created2024-05-22|CS 61C
gdbGDB commands:![[Pasted image 20240522101140.png]]![[Pasted image 20240522101153.png]] valgrindbugs: bohrbug: can appear in certain conditionsheisenbugs: cannot appear in the debugging processWe can use a tool called Valgrind to help catch to help catch “heisenbugs” and “bohrbugs”.emulates your CPU and tracks your memory accesses! 1valgrind ./bork hello
61C-P1-C
Created2024-05-17|CS 61C
Compilegcc hello.ccreates machine language codea.out loads andexecutes programgreat idea in C:![[Pasted image 20240519124500.png]] basic grammarsinput12345#include <stdio.h>int main(int argc, char *argv[]) { // printf("Hello World!\n");return 0;} Combined, argc and argv get the main function to accept arguments. argc will contain the number of strings on the command line (the executable counts as one, plus one for each argument). Here argc is 2: ./a.out myFile argv is ...
61B-P5-6-sort
Created2024-05-15|CS 61B
definitionsAn ordering relation << for keys a, b, and c has the following properties: Law of Trichotomy: Exactly one of a << b, a = b, b << a is true. Law of Transitivity: If a << b, and b << c, then a << c. Java: ComparableIn java, compare or compareTo methods are used. 1234567import java.util.Comparator; public class LengthComparator implements Comparator<String> { public int compare(String x, String b) { return x.length() - ...
61B-P5-5-QuadTree
Created2024-05-15|CS 61B
questionSuppose we want to perform operations on a set of Body objects in space. For example, perhaps we wanted to ask questions about the Sun bodies (shown as yellow dots below) in our two-dimension image space.How many objects are in a region? HashTableiterate over all items to checkproblem: totally random! uniform partitioningOur attempt is to ensure that the bucket numbers depend only on position! uniformly partition our image space by throwing a 4x4 grid over it (“spatial hashing”) implemen ...
C++-intro
Created2024-05-10|Engineering 101
C BasicsWhat C++ brings: Almost all the aspects of C are preserved New features are added, e.g., templates, references Sophisticated programs are easier to code, thanks to OOP C++ is almost a superset of Cnew data types: bool a = false, b = true;new headers: 12#include <iostream>using namespace std; new I/O style: input: cin >> x output: cout << 'string' formatting output: setw(int width): set the width of the output setfill(z): set up the prefix (前缀) of the outp ...
C-intro
Created2024-05-10|Engineering 101
Basic Linux tar usagetar -xvf xxx.tar unziptar -cf xxx.tar ... xxx.c zip basic data typesInteger: intCharacter: charValueless type: voidFractional numbers: Singleprecision: floatDouble precision: doubleVarious types variations:char: signed char, unsigned charint: short int, signed short int, unsigned short int, signed int, unsigned int, long int, signed long int, unsigned long int, long long int, signed long long int, unsigned long long intdouble: long double Basic number typesfloat: 7 digits of ...
1234…6
avatar
Oscar
Articles
57
Tags
48
Categories
11
Follow Me
Announcement
This is my Blog
Recent Post
Untitled2024-09-12
Untitled2024-09-12
web2024-09-12
CSAPP-chap5- Optimizing Program Performance2024-09-02
typst-learning2024-09-02
Categories
  • Algs1
  • CS 1884
  • CS 61A11
  • CS 61B14
  • CS 61C6
  • CS106L4
  • CS110L2
  • CSAPP4
Tags
Scheme python Math Java BST MST C project2 BasicC Algs matlab EE vim Graph RBT X86-64 Shortest_path CS110L ICS 61C System Assembly Git class Linear Algebra Rust GDB Iterators CPU debugging Basic linux AI CSAPP functions BTree 61B CS 61A CS sorting
Archives
  • September 20245
  • August 20245
  • July 20242
  • June 202410
  • May 20249
  • April 202426
Info
Article :
57
UV :
PV :
Last Update :
©2020 - 2024 By Oscar
Framework Hexo|Theme Butterfly