Logo Mina san coding
Logo Inverted Logo
  • Posts
  • Tech
    • Obsidian sync
  • Computer Science
    • Introduction
    • Algorithms
      • Recursion
    • Basic
      • Call Stack
      • Function Call
    • Data Structure
      • Stack
Hero Image
Call Stack

Call stack is a stack data structure that stores information about active subroutines1 of computer program. Subroutines is a sequence of program instructions that performs a specific task, packaged as a unit. ↩︎

June 13, 2020 Read
Hero Image
Function Call

Example of function call Here’s an example of function call written in Javascript. function greet(name){ console.log(`Hello ${name}!`); greet2(name); console.log('Getting ready to say bye...'); bye(); } function greet2(name){ console.log(`How are you, ${name}?`); } function bye(){ console.log('OK bye!'); } greet('Mina'); Steps explanation Memory to store the name Maggie and greetfunction console.log(Hello Mina!); Allocate the second memory box upon the first with: function greet2 Name: Maggie console.log(How are you, Mina?

June 13, 2020 Read
Hero Image
Introduction

Here collect all the notes I took down. In order to complement the knowledge in Computer Science.

June 13, 2020 Read
Hero Image
Recursion

Recursion is the function calling itself. Case Base case: The condition to stop the loop Recursive case: Keep self calling the function function countdown(i){ console.log(i); if (i <= 0) { // Base case return } return countdown(i-1); // Recursive case } Cost Recursion saving the info needs memory, if your recursion have to execute man times, you will need lots of memory. However, it can be solved by Tail Recursion.

June 13, 2020 Read
Hero Image
Stack

Use case Computer use stack internally called the call stack. The example of function call Actions Push: Add a new item to the top Pop: Remove the topmost item and read it function Stack(){ let items = []; this.push = function(item){ items.push(item); } this.pop = function(){ return items.pop(); } this.peek = function(){ return items[items.length-1]; } this.isEmpty = function(){ return items.length ==0; } this.clear = function(){ items = []; } this.

June 13, 2020 Read
Navigation
  • About
  • Skills
  • Experiences
  • Education
  • Projects
  • Recent Posts
  • Accomplishments
Contact me:
  • Email: mp922352612@gmail.com

Toha Theme Logo Toha
© 2021 Copyright.
Powered by Hugo Logo