Posts

strain

Last edited: August 8, 2025

strain is the proportional deformation of a material given some stress applied

Strategies to Revise an Essay

Last edited: August 8, 2025

revising:

  • character as subjects, actions as verbs
  • old before new (connect sentences’ subjects from tail to head)
  • short before long: (say the short phrase before the long phrase, move the verb up front if you can)
  • topic then stress (the last position is being stressed—the thing that’s most important to communicate is the end of an utterance)
  • The above principles apply to all units—as in, each sentences paragraphs, and arguments should all follow a similar principles

Streaming Algorithm

Last edited: August 8, 2025

Streaming Algorithms are computation that grow with the size of the input at a “small”(?) rate. The memory of these systems is not large—they grow roughly logarithmically or poly-logorithmically against the size of the system.

Every so often as we process our system, we have to output a symbol that tells us about the stream we saw so far.

streaming vs FA

Streaming Algorithms is a superset of DFAs: things that Streaming Algorithms can’t do can’t also be done with DFAs. Their memory doesn’t grow too large against the sizes of strings.

stress

Last edited: August 8, 2025

string (C)

Last edited: August 8, 2025

In C, string is an array of chars. C strings don’t track their length; each C string always end in an null-terminating character: \0. This is represents the zero byte.

There’s a built in function strlen which checks the length of a string without the null-terminating character. This function is O(n)!!!

String Pointer Syntax Sugar Synonyms

char str[6];

// these are equivalent
char *ptr = str;
char *ptr = &str[0];
char *ptr = &str; // DON'T DO THIS

// these are equivalent
char thirdLetter = str[3];
char thirdLetter = *(str + 3);

seven commandments of c strings

  1. if we create a string as char[], we can modify its characters because its memory lives in our stack instead of living in a global data segment
  2. we can’t set char[] as equaling to something, because its not strictly a pointer and instead it refers to an entire block of memory instead of a pointer to the first element (in a same vein, an array’s size is fixed and travels with the variable)
  3. if we pass char[] as a parameter, it is converted to a char *
  4. if we create a string with new string literal as char *thing = "thing", we can’t modify it because its on the global data segment
  5. we can set char * equaling to another value because its a pointer
  6. adding an offset to a c string gives a substring that’s places past the first character
  7. if we change characters in a string parameter, these changes will persist

passing strings around

Strings are passed as a pointer to their first character.