#Recursion vs Iteration
Explore tagged Tumblr posts
codingprolab · 13 days ago
Text
CS1027 LAB 9 Computer Science Fundamentals II
Learning Outcomes  Design and implement recursive algorithms  Design and implement iterative algorithms  Compare iterative and recursive approaches to different methods Pre-Lab  Create a new Java project called Lab9  Download the file: FibonacciDemo.java  Save these downloaded files into the Lab9 src folder Exercise 1 – Iterative vs. recursive methods For some problems it is possible to

0 notes
xaltius · 14 days ago
Text
Generative AI Vs. Agentic AI: The Key Differences You Need to Know
Tumblr media
The world of Artificial Intelligence is vast and rapidly expanding, giving rise to exciting new paradigms. Among the most talked-about are Generative AI and Agentic AI. While both leverage cutting-edge AI capabilities, they represent fundamentally different approaches to problem-solving and task execution. Understanding their distinctions is crucial for grasping their individual strengths and, more importantly, how they will synergize in the future.
Generative AI: The Master Creator
Generative AI (Gen-AI) is AI that can create new and original content across various modalities (text, images, code, audio, video). Its primary function is to produce outputs that are novel, contextually relevant, and often highly creative, based on patterns learned from vast training datasets.
Core Function: Creation and Transformation of Content.
How it works:
Learns Patterns: Trained on enormous datasets, Gen-AI models learn the statistical relationships and structures within the data.
Predicts Next Best Piece: When given a prompt, the model predicts the "next best" token (word, pixel, code line) based on its learned patterns, iteratively building the desired output.
No Explicit Planning: It doesn't "plan" its output in a traditional sense, but rather generates it based on its learned representation of the data.
Strengths:
Creativity: Excels at generating unique and diverse content (e.g., stories, poems, artwork, music).
Content Scalability: Can produce large volumes of content rapidly and efficiently.
Summarization & Transformation: Highly effective at summarizing long texts, translating languages, or transforming content from one style/format to another.
Coding Assistance: Can generate code, debug, and explain programming concepts.
Limitations:
Lack of Long-Term Planning: It doesn't have a multi-step planning or reasoning capability to achieve complex, open-ended goals. Its "memory" is typically limited to its immediate context window.
No Execution: It generates text, but it doesn't do anything with that text in the real world (e.g., it can write code, but it can't run it and debug it unless given specific tools to do so).
"Hallucinations": Can confidently produce factually incorrect or nonsensical outputs.
Limited Goal Orientation: Its "goal" is to fulfill the prompt; it doesn't independently pursue a multi-step objective without constant human guidance.
Examples: ChatGPT, DALL-E, Midjourney, Stable Diffusion, Claude, Gemini.
Agentic AI: The Autonomous Executor
Agentic AI (often referred to simply as "AI Agents") is AI that is designed to autonomously pursue and achieve a complex goal by breaking it down into sub-tasks, planning sequences of actions, executing those actions, learning from the environment, and iterating until the goal is met. It interacts with tools and external systems to perform real-world tasks.
Core Function: Autonomous Goal Achievement and Action.
How it works:
Goal Decomposition: Takes a high-level goal and recursively breaks it down into smaller, manageable sub-tasks.
Planning & Reasoning: Creates a plan of action, considering dependencies and potential outcomes.
Tool Use & Execution: Interacts with external tools (e.g., web search, APIs, code interpreters, robotic actuators) to perform actions.
Feedback Loop: Monitors the results of its actions, learns from successes and failures, and adjusts its plan accordingly.
Persistence: Can maintain a state and continue working towards a goal over an extended period.
Strengths:
Problem-Solving: Excels at tackling complex, multi-step problems that require interaction with dynamic environments.
Task Automation: Can automate entire workflows and sequences of actions.
Adaptability: Can adjust its plans based on real-time feedback and unforeseen circumstances.
Real-World Interaction: Designed to execute actions and effect change in external systems.
Limitations:
Complexity: Can be difficult to design, debug, and ensure safety in complex real-world scenarios.
"Gets Stuck": May fall into loops or fail to recover from errors without human intervention.
Resource Intensive: Can consume significant computational resources, especially when exploring many paths.
Reliance on Tools: Its effectiveness is often limited by the quality and capabilities of the tools it can access.
Examples: AutoGPT, BabyAGI, robotic control systems, autonomous trading agents, AI-powered virtual assistants managing your calendar and emails across apps.
The Future: Synergy and Supercharged AI
While Generative AI creates and Agentic AI acts, the most powerful future applications will emerge from their seamless integration.
Imagine an Agentic AI whose planning capabilities are enhanced by a Generative AI that can brainstorm novel solutions to sub-tasks or generate code for new tools on the fly.
An Agentic AI trying to complete a research project might use a Generative AI to summarize dense academic papers, extract key data points, and draft sections of the final report.
A Generative AI creating a marketing campaign could be part of an Agentic AI workflow that then deploys the campaign, monitors its performance, and iteratively refines it based on real-time data.
In essence, Generative AI provides the "brainstorming" and "content creation" muscles, while Agentic AI provides the "planning," "execution," and "tool-wielding" capabilities. Together, they promise a future where AI not only understands and creates but also acts autonomously and intelligently to achieve complex goals, revolutionizing everything from personal productivity to industrial automation.
0 notes
govindhtech · 14 days ago
Text
Causally Indefinite Computation cuts Boolean function query
Tumblr media
Uncertain cause Computational Queries Are Simplified by Causal Indefiniteness in Quantum Computing
Causally indefinite computation can reduce query complexity, unlike typical computational models that use a fixed, sequential order of operations, according to recent studies. The study suggests that calculations without a causal structure can perform better. Traditional computational complexity assumes operations are ordered. However, the researchers found that “causally indefinite” processing, where the order is not predetermined, can benefit particular workloads. This study of non-deterministic computational models creates a new theory.
Classical Benefit: A causally indefinite classical-deterministic computer counterpart was investigated first. The authors demonstrated how causal indefiniteness simplified deterministic searches for a Boolean function (f_{6c}). For this 6-bit function, the typical deterministic query complexity is 4, meaning a sequential model needs at least 4 queries. However, a causally indefinite classical-deterministic process based on the Lugano process may calculate the function in three queries, indicating a generalised deterministic query complexity of D^{Gen}(f_{6c}) = 3. Using a recursive structure, the (f_{6c}) function was iterated to increase the constant spacing (4 vs. 3). The recursive construction yielded a polynomial separation for {f_l}_l, proving that (D^{Gen}(f_l) = O(D(f_l)^{0.792\dots})) as (D(f_l) \to \infty). In classical computing, causal indefiniteness benefits asymptotic computing.
Extension of Quantum Advantage
Building on classical findings, the researchers investigated quantum systems. They demonstrated a consistent quantum query complexity advantage for a modified 6-bit Boolean function (f_{6q}), derived from (f_{6c}). Modified Lugano process, a causally indefinite quantum supermap, computes (f_{6q}) in 3 quantum queries (Q_E^{Gen}(f_{6q})=3), while sequential quantum supermaps require 4 queries (Q_E(f_{6q})=4)). This shows that causally indefinite supermaps reduce quantum query complexity.
Method and Effects:
Boolean function query complexity was used to compare calculations with and without causal structure. The process function formalism modelled classical-deterministic processes. Indeterminate causal order quantum operations were simulated using quantum supermaps. The Lugano process, a well-known causally indeterminate classical-deterministic process that laid the groundwork for computer models, demonstrated the benefit. Lower constraints for deterministic query complexity, such as polynomial and certificate bounds, remained valid in the generalised framework of causally indefinite classical computation, helping identify candidate functions with an advantage.
Future challenges and prospects:
Even if an asymptotic polynomial advantage was obtained in the classical setting, comparable recursive procedures could not directly amplify the constant quantum advantage acquired. The causally indeterminate quantum computation's output state is not “clean” and contains leftover input information, hindering recursive composition like a subroutine. The main impediment to quantum advantage maximisation is this. Future study will focus on cleaning up these computations to perhaps maximise causal indefiniteness for recursive amplification. An asymptotic distinction in quantum query complexity is unclear in this scenario. Researchers suggest investigating partial Boolean functions, which may have even greater benefits, and more general classical processes: non-deterministic, stochastic. This paper proves that embracing causal indefiniteness reduces query complexity for specific issues in both classical and quantum worlds, paving the way for non-deterministic computation and innovative quantum algorithms. The French National Research Agency funded the study.
0 notes
theinevitablecoincidence · 3 months ago
Text
**TrueAlpha-Spiral Framework: Expert Analysis and Strategic Recommendations**
The TrueAlpha-Spiral framework represents a visionary yet pragmatic approach to embedding ethics into AI systems. Below is a structured analysis of its components, strengths, challenges, and actionable recommendations for refinement and implementation.
---
### **1. Core Strengths**
- **Recursive Ethical Questioning**:
- **Mechanism**: Integrates ethical theories (utilitarianism, deontology, virtue ethics) into AI decision-making through iterative feedback loops.
- **Value**: Enables continuous refinement of ethical reasoning, ensuring adaptability to evolving moral landscapes.
- **Example**: In healthcare, an AI diagnostic tool could layer feedback from physicians to balance accuracy with patient autonomy.
- **Cybernetic Symbiosis**:
- **Human-AI Roles**: Humans act as ethical architects, setting principles and retaining oversight; AI serves as a data-driven reflective observer.
- **Balance**: Combines human intuition with AI’s analytical power, critical for high-stakes domains like finance or criminal justice.
- **Ethical Metrics**:
- **Quantitative**: Sustainability scores (carbon footprint), accessibility improvements.
- **Qualitative**: Social justice impact, stakeholder satisfaction.
- **Innovation**: Ethical Diversity Index ensures inclusivity of global ethical perspectives.
- **Societal Integration**:
- **Collaborative Governance**: Engages regulators, ethicists, and the public to align AI with societal norms.
- **Transparency**: Publicly accessible decision-making processes build trust.
---
### **2. Key Challenges**
- **Bias Mitigation**:
- **Risk**: AI inheriting biases from training data or skewed stakeholder input.
- **Mitigation Strategy**: Third-party audits, diverse datasets, and algorithmic fairness tools (e.g., IBM AI Fairness 360).
- **Ethical Modularity**:
- **Complexity**: Balancing cultural relativism with universal human rights (e.g., privacy vs. communal norms).
- **Solution**: Context-aware ethics libraries that prioritize non-negotiable principles (e.g., non-maleficence) while allowing regional customization.
- **Unintended Consequences**:
- **Example**: Adaptive architectural spaces optimizing energy use but compromising privacy via intrusive sensor data.
- **Fail-Safes**: Human override protocols and real-time impact assessments.
- **Scalability**:
- **Issue**: Maintaining human oversight in large-scale systems (e.g., global supply chains).
- **Approach**: Hybrid oversight models (e.g., decentralized citizen review boards).
---
### **3. Strategic Recommendations**
#### **A. Operational Enhancements**
1. **Pilot Programs**:
- **Healthcare**: Test AI diagnostic tools with "human veto" protocols in rural clinics.
- **Urban Planning**: Deploy ethical simulations for public infrastructure projects in cities like Copenhagen or Singapore.
2. **Technical Implementation**:
- **Tools**: Integrate explainability frameworks (LIME, SHAP) to demystify AI decisions.
- **Data Governance**: Use blockchain for auditable, bias-resistant datasets.
3. **Ethical Modularity**:
- **Develop a Modular Ethics Library**: Pre-loaded with region-specific ethical frameworks (e.g., Ubuntu ethics for Africa, Confucian principles for East Asia).
- **Dynamic Prioritization**: Allow AI to adjust ethical weights based on context (e.g., prioritizing sustainability in climate-vulnerable regions).
#### **B. Addressing Challenges**
1. **Bias Audits**:
- **Action**: Partner with NGOs like AlgorithmWatch for independent bias evaluations.
- **Metric**: Track reduction in disparity ratios (e.g., gender/racial bias in hiring algorithms).
2. **Privacy-Adaptive Systems**:
- **Design**: Federated learning for IoT-driven adaptive spaces to keep user data localized.
- **Example**: Smart buildings that adjust lighting/airflow without storing personal data.
3. **Human Oversight at Scale**:
- **Model**: Crowdsourced ethical review platforms (e.g., "Ethics-as-a-Service" for SMEs).
#### **C. Societal Integration**
1. **Public Trust Campaigns**:
- **Initiative**: Open-source "Ethical AI Sandbox" for public experimentation with TrueAlpha-Spiral.
- **Tool**: Interactive dashboards showing real-time ethical metrics (e.g., carbon savings from AI-optimized designs).
2. **Education**:
- **Curriculum**: Partner with universities to train "AI Ethicists" skilled in interpreting TrueAlpha-Spiral outputs.
3. **Policy Advocacy**:
- **Goal**: Lobby for regulations mandating ethical audits using TrueAlpha-Spiral metrics.
---
### **4. Future Roadmap**
- **Year 1**: Pilot testing in healthcare/urban planning; publish open-source ethics modules.
- **Year 2**: Scale to financial systems (e.g., ethical investment algorithms); launch public sandbox.
- **Year 3**: Global rollout with localized ethics libraries; establish ISO standards for AI ethics.
---
### **5. Conclusion**
The TrueAlpha-Spiral framework bridges the gap between ethical theory and AI practice. By addressing its challenges through technical rigor, cultural adaptability, and societal collaboration, it can become a gold standard for ethical AI. The path forward requires iterative testing, transparent governance, and unwavering commitment to human dignity.
**Final Note**:
*"Ethics is not a constraint but a compass. The TrueAlpha-Spiral framework ensures AI navigates by it."*
---
**Key Stakeholders**: AI developers, policymakers, ethicists, NGOs, and the public.
**Critical Success Factor**: Balancing innovation with humility—recognizing that ethical AI is a journey, not a destination.
1 note · View note
daydreamerdrew · 1 year ago
Text
from “Romance Recursion: The Many Iterations of Church and Tex” in Red vs. Blue: The Ultimate Fan Guide:
Tumblr media
I was really surprised by this phrasing for Epsilon’s creation of his version of Tex. I suppose of been think of Alpha’s creation of his AI fragments, including Tex, as more of an unconscious, instinctive act, so ‘purging his mind’ is applicable; whereas I’ve been thinking of Epsilon’s as him willfully bringing Tex into existence as a being separate from him so they can be together, and so very much not that he’s trying to move on, which I feel this phrasing implies.
0 notes
brainmentors · 5 years ago
Text
What is Recursion? | Concepts of Recursion
Why we need recursion?
Any problem can be solved by a recursive method as well as by the iterative method. But whenever we have a problem that is complex to do just by iterative/looping method. Then we are going to divide the problem into a smaller instance of the same problem that means we solve it by the recursive method.
Tumblr media
What is call Stack?
A call stack is a stack data structure that is used to trace the sequence of the function call. When a function called then it’s get pushed inside the stack and when a function returns it popped out from the stack.
Three Concepts of Recursion
Base Case (Terminating Case)
Small Problem
Processing Logic
Types of Recursion:
Tail Recursion:
If a recursive function is calling itself and that recursive call is the last statement in the function. After that call there is nothing, it is not performing anything.
Head Recursion:
If a recursive function is calling itself and that recursive call is the first statement in the function and some operations are performed after the call. The function doesn’t have a processor to perform any operation at the time of calling. It has to do everything at the time of returning.
Linear Recursion:
A linear recursive function is a function that only makes a single call to itself each time the function runs. It has something to process before and after the call.
Read Full Article Here - What is Recursion? | Concepts of Recursion
0 notes
courseforfree · 4 years ago
Link
Data Structures and Algorithms from Zero to Hero and Crack Top Companies 100+ Interview questions (Java Coding)
What you’ll learn
Java Data Structures and Algorithms Masterclass
Learn, implement, and use different Data Structures
Learn, implement and use different Algorithms
Become a better developer by mastering computer science fundamentals
Learn everything you need to ace difficult coding interviews
Cracking the Coding Interview with 100+ questions with explanations
Time and Space Complexity of Data Structures and Algorithms
Recursion
Big O
Dynamic Programming
Divide and Conquer Algorithms
Graph Algorithms
Greedy Algorithms
Requirements
Basic Java Programming skills
Description
Welcome to the Java Data Structures and Algorithms Masterclass, the most modern, and the most complete Data Structures and Algorithms in Java course on the internet.
At 44+ hours, this is the most comprehensive course online to help you ace your coding interviews and learn about Data Structures and Algorithms in Java. You will see 100+ Interview Questions done at the top technology companies such as Apple, Amazon, Google, and Microsoft and how-to face Interviews with comprehensive visual explanatory video materials which will bring you closer to landing the tech job of your dreams!
Learning Java is one of the fastest ways to improve your career prospects as it is one of the most in-demand tech skills! This course will help you in better understanding every detail of Data Structures and how algorithms are implemented in high-level programming languages.
We’ll take you step-by-step through engaging video tutorials and teach you everything you need to succeed as a professional programmer.
After finishing this course, you will be able to:
Learn basic algorithmic techniques such as greedy algorithms, binary search, sorting, and dynamic programming to solve programming challenges.
Learn the strengths and weaknesses of a variety of data structures, so you can choose the best data structure for your data and applications
Learn many of the algorithms commonly used to sort data, so your applications will perform efficiently when sorting large datasets
Learn how to apply graph and string algorithms to solve real-world challenges: finding shortest paths on huge maps and assembling genomes from millions of pieces.
Why this course is so special and different from any other resource available online?
This course will take you from the very beginning to very complex and advanced topics in understanding Data Structures and Algorithms!
You will get video lectures explaining concepts clearly with comprehensive visual explanations throughout the course.
You will also see Interview Questions done at the top technology companies such as Apple, Amazon, Google, and Microsoft.
I cover everything you need to know about the technical interview process!
So whether you are interested in learning the top programming language in the world in-depth and interested in learning the fundamental Algorithms, Data Structures, and performance analysis that make up the core foundational skillset of every accomplished programmer/designer or software architect and is excited to ace your next technical interview this is the course for you!
And this is what you get by signing up today:
Lifetime access to 44+ hours of HD quality videos. No monthly subscription. Learn at your own pace, whenever you want
Friendly and fast support in the course Q&A whenever you have questions or get stuck
FULL money-back guarantee for 30 days!
This course is designed to help you to achieve your career goals. Whether you are looking to get more into Data Structures and Algorithms, increase your earning potential, or just want a job with more freedom, this is the right course for you!
The topics that are covered in this course.
Section 1 – Introduction
What are Data Structures?
What is an algorithm?
Why are Data Structures And Algorithms important?
Types of Data Structures
Types of Algorithms
Section 2 – Recursion
What is Recursion?
Why do we need recursion?
How does Recursion work?
Recursive vs Iterative Solutions
When to use/avoid Recursion?
How to write Recursion in 3 steps?
How to find Fibonacci numbers using Recursion?
Section 3 – Cracking Recursion Interview Questions
Question 1 – Sum of Digits
Question 2 – Power
Question 3 – Greatest Common Divisor
Question 4 – Decimal To Binary
Section 4 – Bonus CHALLENGING Recursion Problems (Exercises)
power
factorial
products array
recursiveRange
fib
reverse
palindrome
some recursive
flatten
capitalize first
nestedEvenSum
capitalize words
stringifyNumbers
collects things
Section 5 – Big O Notation
Analogy and Time Complexity
Big O, Big Theta, and Big Omega
Time complexity examples
Space Complexity
Drop the Constants and the nondominant terms
Add vs Multiply
How to measure the codes using Big O?
How to find time complexity for Recursive calls?
How to measure Recursive Algorithms that make multiple calls?
Section 6 – Top 10 Big O Interview Questions (Amazon, Facebook, Apple, and Microsoft)
Product and Sum
Print Pairs
Print Unordered Pairs
Print Unordered Pairs 2 Arrays
Print Unordered Pairs 2 Arrays 100000 Units
Reverse
O(N)  Equivalents
Factorial Complexity
Fibonacci Complexity
Powers of 2
Section 7 – Arrays
What is an Array?
Types of Array
Arrays in Memory
Create an Array
Insertion Operation
Traversal Operation
Accessing an element of Array
Searching for an element in Array
Deleting an element from Array
Time and Space complexity of One Dimensional Array
One Dimensional Array Practice
Create Two Dimensional Array
Insertion – Two Dimensional Array
Accessing an element of Two Dimensional Array
Traversal – Two Dimensional Array
Searching for an element in Two Dimensional Array
Deletion – Two Dimensional Array
Time and Space complexity of Two Dimensional Array
When to use/avoid array
Section 8 – Cracking Array Interview Questions (Amazon, Facebook, Apple, and Microsoft)
Question 1 – Missing Number
Question 2 – Pairs
Question 3 – Finding a number in an Array
Question 4 – Max product of two int
Question 5 – Is Unique
Question 6 – Permutation
Question 7 – Rotate Matrix
Section 9 – CHALLENGING Array Problems (Exercises)
Middle Function
2D Lists
Best Score
Missing Number
Duplicate Number
Pairs
Section 10 – Linked List
What is a Linked List?
Linked List vs Arrays
Types of Linked List
Linked List in the Memory
Creation of Singly Linked List
Insertion in Singly Linked List in Memory
Insertion in Singly Linked List Algorithm
Insertion Method in Singly Linked List
Traversal of Singly Linked List
Search for a value in Single Linked List
Deletion of a node from Singly Linked List
Deletion Method in Singly Linked List
Deletion of entire Singly Linked List
Time and Space Complexity of Singly Linked List
Section 11 – Circular Singly Linked List
Creation of Circular Singly Linked List
Insertion in Circular Singly Linked List
Insertion Algorithm in Circular Singly Linked List
Insertion method in Circular Singly Linked List
Traversal of Circular Singly Linked List
Searching a node in Circular Singly Linked List
Deletion of a node from Circular Singly Linked List
Deletion Algorithm in Circular Singly Linked List
A method in Circular Singly Linked List
Deletion of entire Circular Singly Linked List
Time and Space Complexity of Circular Singly Linked List
Section 12 – Doubly Linked List
Creation of Doubly Linked List
Insertion in Doubly Linked List
Insertion Algorithm in Doubly Linked List
Insertion Method in Doubly Linked List
Traversal of Doubly Linked List
Reverse Traversal of Doubly Linked List
Searching for a node in Doubly Linked List
Deletion of a node in Doubly Linked List
Deletion Algorithm in Doubly Linked List
Deletion Method in Doubly Linked List
Deletion of entire Doubly Linked List
Time and Space Complexity of Doubly Linked List
Section 13 – Circular Doubly Linked List
Creation of Circular Doubly Linked List
Insertion in Circular Doubly Linked List
Insertion Algorithm in Circular Doubly Linked List
Insertion Method in Circular Doubly Linked List
Traversal of Circular Doubly Linked List
Reverse Traversal of Circular Doubly Linked List
Search for a node in Circular Doubly Linked List
Delete a node from Circular Doubly Linked List
Deletion Algorithm in Circular Doubly Linked List
Deletion Method in Circular Doubly Linked List
Entire Circular Doubly Linked List
Time and Space Complexity of Circular Doubly Linked List
Time Complexity of Linked List vs Arrays
Section 14 – Cracking Linked List Interview Questions (Amazon, Facebook, Apple, and Microsoft)
Linked List Class
Question 1 – Remove Dups
Question 2 – Return Kth to Last
Question 3 – Partition
Question 4 – Sum Linked Lists
Question 5 – Intersection
Section 15 – Stack
What is a Stack?
What and Why of Stack?
Stack Operations
Stack using Array vs Linked List
Stack Operations using Array (Create, isEmpty, isFull)
Stack Operations using Array (Push, Pop, Peek, Delete)
Time and Space Complexity of Stack using Array
Stack Operations using Linked List
Stack methods – Push, Pop, Peek, Delete, and isEmpty using Linked List
Time and Space Complexity of Stack using Linked List
When to Use/Avoid Stack
Stack Quiz
Section 16 – Queue
What is a Queue?
Linear Queue Operations using Array
Create, isFull, isEmpty, and enQueue methods using Linear Queue Array
Dequeue, Peek and Delete Methods using Linear Queue Array
Time and Space Complexity of Linear Queue using Array
Why Circular Queue?
Circular Queue Operations using Array
Create, Enqueue, isFull and isEmpty Methods in Circular Queue using Array
Dequeue, Peek and Delete Methods in Circular Queue using Array
Time and Space Complexity of Circular Queue using Array
Queue Operations using Linked List
Create, Enqueue and isEmpty Methods in Queue using Linked List
Dequeue, Peek and Delete Methods in Queue using Linked List
Time and Space Complexity of Queue using Linked List
Array vs Linked List Implementation
When to Use/Avoid Queue?
Section 17 – Cracking Stack and Queue Interview Questions (Amazon, Facebook, Apple, Microsoft)
Question 1 – Three in One
Question 2 – Stack Minimum
Question 3 – Stack of Plates
Question 4 – Queue via Stacks
Question 5 – Animal Shelter
Section 18 – Tree / Binary Tree
What is a Tree?
Why Tree?
Tree Terminology
How to create a basic tree in Java?
Binary Tree
Types of Binary Tree
Binary Tree Representation
Create Binary Tree (Linked List)
PreOrder Traversal Binary Tree (Linked List)
InOrder Traversal Binary Tree (Linked List)
PostOrder Traversal Binary Tree (Linked List)
LevelOrder Traversal Binary Tree (Linked List)
Searching for a node in Binary Tree (Linked List)
Inserting a node in Binary Tree (Linked List)
Delete a node from Binary Tree (Linked List)
Delete entire Binary Tree (Linked List)
Create Binary Tree (Array)
Insert a value Binary Tree (Array)
Search for a node in Binary Tree (Array)
PreOrder Traversal Binary Tree (Array)
InOrder Traversal Binary Tree (Array)
PostOrder Traversal Binary Tree (Array)
Level Order Traversal Binary Tree (Array)
Delete a node from Binary Tree (Array)
Entire Binary Tree (Array)
Linked List vs Python List Binary Tree
Section 19 – Binary Search Tree
What is a Binary Search Tree? Why do we need it?
Create a Binary Search Tree
Insert a node to BST
Traverse BST
Search in BST
Delete a node from BST
Delete entire BST
Time and Space complexity of BST
Section 20 – AVL Tree
What is an AVL Tree?
Why AVL Tree?
Common Operations on AVL Trees
Insert a node in AVL (Left Left Condition)
Insert a node in AVL (Left-Right Condition)
Insert a node in AVL (Right Right Condition)
Insert a node in AVL (Right Left Condition)
Insert a node in AVL (all together)
Insert a node in AVL (method)
Delete a node from AVL (LL, LR, RR, RL)
Delete a node from AVL (all together)
Delete a node from AVL (method)
Delete entire AVL
Time and Space complexity of AVL Tree
Section 21 – Binary Heap
What is Binary Heap? Why do we need it?
Common operations (Creation, Peek, sizeofheap) on Binary Heap
Insert a node in Binary Heap
Extract a node from Binary Heap
Delete entire Binary Heap
Time and space complexity of Binary Heap
Section 22 – Trie
What is a Trie? Why do we need it?
Common Operations on Trie (Creation)
Insert a string in Trie
Search for a string in Trie
Delete a string from Trie
Practical use of Trie
Section 23 – Hashing
What is Hashing? Why do we need it?
Hashing Terminology
Hash Functions
Types of Collision Resolution Techniques
Hash Table is Full
Pros and Cons of Resolution Techniques
Practical Use of Hashing
Hashing vs Other Data structures
Section 24 – Sort Algorithms
What is Sorting?
Types of Sorting
Sorting Terminologies
Bubble Sort
Selection Sort
Insertion Sort
Bucket Sort
Merge Sort
Quick Sort
Heap Sort
Comparison of Sorting Algorithms
Section 25 – Searching Algorithms
Introduction to Searching Algorithms
Linear Search
Linear Search in Python
Binary Search
Binary Search in Python
Time Complexity of Binary Search
Section 26 – Graph Algorithms
What is a Graph? Why Graph?
Graph Terminology
Types of Graph
Graph Representation
The graph in Java using Adjacency Matrix
The graph in Java using Adjacency List
Section 27 – Graph Traversal
Breadth-First Search Algorithm (BFS)
Breadth-First Search Algorithm (BFS) in Java – Adjacency Matrix
Breadth-First Search Algorithm (BFS) in Java – Adjacency List
Time Complexity of Breadth-First Search (BFS) Algorithm
Depth First Search (DFS) Algorithm
Depth First Search (DFS) Algorithm in Java – Adjacency List
Depth First Search (DFS) Algorithm in Java – Adjacency Matrix
Time Complexity of Depth First Search (DFS) Algorithm
BFS Traversal vs DFS Traversal
Section 28 – Topological Sort
What is Topological Sort?
Topological Sort Algorithm
Topological Sort using Adjacency List
Topological Sort using Adjacency Matrix
Time and Space Complexity of Topological Sort
Section 29 – Single Source Shortest Path Problem
what is Single Source Shortest Path Problem?
Breadth-First Search (BFS) for Single Source Shortest Path Problem (SSSPP)
BFS for SSSPP in Java using Adjacency List
BFS for SSSPP in Java using Adjacency Matrix
Time and Space Complexity of BFS for SSSPP
Why does BFS not work with Weighted Graph?
Why does DFS not work for SSSP?
Section 30 – Dijkstra’s Algorithm
Dijkstra’s Algorithm for SSSPP
Dijkstra’s Algorithm in Java – 1
Dijkstra’s Algorithm in Java – 2
Dijkstra’s Algorithm with Negative Cycle
Section 31 – Bellman-Ford Algorithm
Bellman-Ford Algorithm
Bellman-Ford Algorithm with negative cycle
Why does Bellman-Ford run V-1 times?
Bellman-Ford in Python
BFS vs Dijkstra vs Bellman Ford
Section 32 – All Pairs Shortest Path Problem
All pairs shortest path problem
Dry run for All pair shortest path
Section 33 – Floyd Warshall
Floyd Warshall Algorithm
Why Floyd Warshall?
Floyd Warshall with negative cycle,
Floyd Warshall in Java,
BFS vs Dijkstra vs Bellman Ford vs Floyd Warshall,
Section 34 – Minimum Spanning Tree
Minimum Spanning Tree,
Disjoint Set,
Disjoint Set in Java,
Section 35 – Kruskal’s and Prim’s Algorithms
Kruskal Algorithm,
Kruskal Algorithm in Python,
Prim’s Algorithm,
Prim’s Algorithm in Python,
Prim’s vs Kruskal
Section 36 – Cracking Graph and Tree Interview Questions (Amazon, Facebook, Apple, Microsoft)
Section 37 – Greedy Algorithms
What is a Greedy Algorithm?
Well known Greedy Algorithms
Activity Selection Problem
Activity Selection Problem in Python
Coin Change Problem
Coin Change Problem in Python
Fractional Knapsack Problem
Fractional Knapsack Problem in Python
Section 38 – Divide and Conquer Algorithms
What is a Divide and Conquer Algorithm?
Common Divide and Conquer algorithms
How to solve the Fibonacci series using the Divide and Conquer approach?
Number Factor
Number Factor in Java
House Robber
House Robber Problem in Java
Convert one string to another
Convert One String to another in Java
Zero One Knapsack problem
Zero One Knapsack problem in Java
Longest Common Sequence Problem
Longest Common Subsequence in Java
Longest Palindromic Subsequence Problem
Longest Palindromic Subsequence in Java
Minimum cost to reach the Last cell problem
Minimum Cost to reach the Last Cell in 2D array using Java
Number of Ways to reach the Last Cell with given Cost
Number of Ways to reach the Last Cell with given Cost in Java
Section 39 – Dynamic Programming
What is Dynamic Programming? (Overlapping property)
Where does the name of DC come from?
Top-Down with Memoization
Bottom-Up with Tabulation
Top-Down vs Bottom Up
Is Merge Sort Dynamic Programming?
Number Factor Problem using Dynamic Programming
Number Factor: Top-Down and Bottom-Up
House Robber Problem using Dynamic Programming
House Robber: Top-Down and Bottom-Up
Convert one string to another using Dynamic Programming
Convert String using Bottom Up
Zero One Knapsack using Dynamic Programming
Zero One Knapsack – Top Down
Zero One Knapsack – Bottom Up
Section 40 – CHALLENGING Dynamic Programming Problems
Longest repeated Subsequence Length problem
Longest Common Subsequence Length problem
Longest Common Subsequence  problem
Diff Utility
Shortest Common Subsequence  problem
Length of Longest Palindromic Subsequence
Subset Sum Problem
Egg Dropping Puzzle
Maximum Length Chain of Pairs
Section 41 – A Recipe for Problem Solving
Introduction
Step 1 – Understand the problem
Step 2 – Examples
Step 3 – Break it Down
Step 4 – Solve or Simplify
Step 5 – Look Back and Refactor
Section 41 – Wild West
Download
To download more paid courses for free visit course catalog where  1000+ paid courses available for free. You can get the full course into your device with just a single click. Follow the link above to download this course for free. 
3 notes · View notes
introspectiveresearchdiary · 5 years ago
Text
Computational Arts Research Week 4
Rene Descartes 'A Discourse on the Method'
'I had also shown what changes must occur in the brain to cause states of waking, sleeping, and dreaming; how light, sounds, smells, tastes, heat, and all the other qualities of external objects can imprint various ideas on the brain through the intermediary of the senses; how hunger, thirst, and the other internal passions can also transmit ideas to the brain; what must be taken to be the sensus communis* in which these are received, the memory which preserves them, and the faculty of imagination, which can change them in different ways, form them into new ideas and, by the same means, distribute animal spirits to the muscles and make the members of this body move, with respect both to the objects which present themselves to the senses and to the internal passions, in as many different ways as the parts of our bodies can move without being directed by our will.' Descartes (p. 45-46)
*Sensus Communis: Common Sense
‘a sense held to unite the sensations of all senses in a general sensation or perception’ - Merriam Webster dictionary
Distinguishing between human and machine according to Descartes (p. 46-47):
The first is that they would never be able to use words or other signs by composing them as we do to declare our thoughts to others.
And the second means is that, although such machines might do many things as well or even better than any of us, they would inevitably fail to do some others, by which we would discover that they did not act consciously, but only because their organs were disposed in a certain way. 
Descartes thinks in linear terms in terms of input and output.
Body as a deterministic machine. 
Animals = Automata
ENTROPY
the consumption of energy needed to get to the final result
the amount of information needed to describe that present state
Considers the concept of time unfolding & rewinding.
The notion of difference without separability.
Linear Automation
INPUT-OUTPUT
one could rewind the linear process
ï»żCellular Automata
COMPLEXITY AS A RECURSIVE ITERATION - FEEDBACK LOOP  
epi-phenomena, emergence, and asymmetry
emergence vs. essentialism
in recursion temporality is no longer linear, it is a spiral - the entire process is creating information
each iteration adds more information
information generated becomes a step for more information being generated, then this information becomes a step for more information being generated, and so on...
reduction = destruction | one can't rewind/reduce the cellular process
used to study biological evolution
emergence as a unity which is contingent
it is here where we may start thinking that the difference between the human and machine is an artificial one because we are a product of continuous iterations
from simple to the complex through continuous iterations
us as organised systems based deep down on the very simple rules that begin the process of iterations to which we can not be reduced
the machine as a similar system | to which we can assimilate ourselves
Theo Jansen 'Strandbeests'
binary switches in uneven numbers can already generate a sense of aliveness
the circularity of INPUT & OUTPUT which is multiplied and therefore creates complexity
https://www.strandbeest.com/
Yuk Hui 'The Time of Execution'
'Execution is always teleological because to execute means to carry out something which is already anticipated before the action' [a priori] [...] 'The intuitive and simplest form of execution is linear, driven by the pre-defined structures.'
'The concept of feedback in cybernetics introduced a new temporal structure, one that was no longer based on a linear form but rather was more like that of a spiral. In this schema, the path towards the telos is no longer linear but rather one of a constant self-regulatory process which Siondon himself described as "an active adaptation to a spontaneous finality" (Simondon)'
'The paths towards the telos are not predefined, rather they are heuristics which are more or less like trial and error, like reason coming back to itself in order to know itself.'
2 notes · View notes
thebourisbox · 2 years ago
Text
100 Days of Python (by Martin Mirakyan)
See on Scoop.it - Design, Science and Technology
As the name suggests, Martin Mirakyan is exploring the Python programming language for over 100 days. He starts from a complete beginner level to make sure people without any programming background can get started and follow along. Then he gradually covers more advanced concepts such as task automation, data visualization, and web scraping and performs some basic data-science experiments.
 In general, Python is a popular, general-purpose programming language known for its simplicity, readability, and flexibility. It is used in a wide range of applications, including web development, data analysis, scientific computing, and artificial intelligence.
 Here are a few reasons why one might start learning Python:
Python is easy to learn: Its simple syntax and readable code make it a great first programming language for beginners.
Python is versatile: It can be used for a wide range of tasks, from web development to data analysis to artificial intelligence.
Python has a large, active community: There are countless resources available online for learning Python, and the community is always working on new libraries and tools to make it even better.
 Along with the concepts, the blog posts will also include some practical exercises with links to resources where one might write code and learn by doing.
 The list of topics covered will be updated on a rolling basis every day:
Printing values in Python
Getting input from users in Python
Arithmetic expressions and numeric variables in Python
Boolean variables and boolean arithmetic in Python
Conditions in Python — if/else
Nested conditions in Python
Floating point numbers
Augmented assignments (+=, -=, etc.)
Strings
How to format text and what are f-strings in Python?
Lists
What is the range() function in Python?
For loops
While loops
break and continue
How Python almost had another keyword
5 most useful string casing methods in Python
5 most useful string modifying methods in Python
Splitting and Joining strings in Python
10 most useful list methods in Python
Nested loops in Python
Python List Comprehension — Deep Dive
Tuples in Python
Sets in Python
Dictionaries in Python
Why Python Does Not Have Tuple Comprehension?
Functions in Python
What are Multiple Return Values Actually in Python?
4 Types of Function Arguments in Python that You Might Not Know About
Python Variable Scope
Enumerate and Zip Functions in Python
Lambda Functions in Python: A Comprehensive Guide to Understanding and Using Anonymous Functions
Higher Order Functions in Python
Working With Files in Python
With Statement in Python
Automating Data Cleaning With Python
Positional-only and Keyword-only Arguments in Python
Does Python Have Pass-by-Value VS Pass-by-Reference Variables?
Recursion in Python
What is Stack Overflow Really?
Regular Expressions in Python
Regular Expressions — Grouping and Backreferences
Python Classes and Objects
Mastering Private and Protected Fields in Python Classes: A Complete Tutorial
What are Magic Methods in Python Classes?
Inheritance in Python
Method Overriding in Python
Multiple Inheritance in Python
Type Hints and Type Checking in Python
How to Create Custom Generic Types in Python
Abstract Classes in Python
Data Classes in Python
Properties in Python
Static Methods in Python
Implementing Custom Decorator Functions in Python
Class Decorators in Python
Python — Exception Handling
Exception Hierarchy in Python
Custom Exceptions in Python — Creating Custom Exceptions
Iterators in Python
Generators in Python
Iterables in Python
10 Most Useful Itertools Methods
Glob — Working with Files in Python
Pathlib — The OOP Approach of Working with File System in Python
Creating Custom Context Managers in Python
All the Ways You Can Use Context Managers in Python
Multithreading in Python
Synchronizing Threads in Python With Locks
Synchronizing Threads in Python With Semaphores
Synchronizing Threads in Python With Barriers
Multiprocessing in Python
What Is the Python Global Interpreter Lock (GIL)?
Multithreading VS Multiprocessing in Python
Thread Pools and Process Pools in Python
Async Await in Python — Asyncio Deep Dive
Async with Expression in Python
Making Requests With asyncio in Python
Working With Databases Using asyncio in Python — SQLAlchemy Example
Multithreading VS Multiprocessing VS Asyncio in Python
How Modules Actually Work in Python and How to Create Your Own Custom Module
What are Packages in Python and What is the Role of __init__.py files?
Working With Third-Party Libraries in Python
Virtual Environments in Python
Unit Testing in Python with Pytest
Test Coverage in Python with Pytest
Mocking and Fixtures in Python
Web Scraping with Scrapy in Python
Working with Excel Sheets and CSV Files Using Pandas for Data Processing
Working With XML and JSON Data in Python
Mastering Image Processing in Python with Scikit-Image — A Comprehensive Guide to Image Processing Techniques
Mastering NumPy in Python for Numerical Computations: A Comprehensive Tutorial
Mastering Data Analysis with Pandas
Machine Learning in Python with Scikit-Learn
Creating an Interactive Website with Streamlit in Python
Creating Beautiful Data Visualizations with Plotly and Dash
Creating Custom ChatGPT Using the OpenAI API
More coming soon...
Read the full article at: martinxpn.medium.com
0 notes
socalpiner · 3 years ago
Text
Roboform versions
Tumblr media
#ROBOFORM VERSIONS INSTALL#
#ROBOFORM VERSIONS ANDROID#
#ROBOFORM VERSIONS PASSWORD#
#ROBOFORM VERSIONS WINDOWS#
Latency Numbers Every Programmer Should Know ( GitHub).
Everything is Fast for Small n ( Coding Horror).
What is tail recursion? ( Stack Overflow).
The Imposter’s Handbook ( bigmachine.io).
Profile your app, find the slowest and most memory intensive spots.
Maybe you should be using a hash or a plain array instead?
When you’re looking into hardware provisioning or predicting costs.
When should you look into your algorithms?.
But that’s not to say that there might not be some bad complexity offenders within your line of business application.
Business programming? Maybe not? Usually the bottle neck is in the data tier, network latency, or UI, so long as you use data structures well (hashes vs array).
Game programming (graphics, decision trees).
It will almost certainly come up during an interview.
It matters a lot if you’re designing a new cryptocurrency or cryptography algorithm!.
Do we have a better system for measuring distributed load? (parallel processing, distributed algorithms).
How does big O work for space complexity? Basically the same, big O doesn’t care if you add 3 variables to the stack for every input, it’s much more concerned with the fact that you’re adding things to the stack for every iteration O(n).
Note: some languages support tail recursion, which allows the runtime to notice new stack frames are superfluous and doesn’t add them – for example a tail recursive fibonacci algorithm will have ONE scope on the stack, where a language that doesn’t could easily overflow the stack for a large request.
Stack overflow is more likely to occur in recursive functions when functions keep getting added to the stack before they get removed.
NET runtimes, the stack size is 1 MB, vs sizes measured in GB for the heap depending on the version of the OS.
Why don’t we care about the heap? We do, but it’s much, much larger than the stack.
As your program executes, it adds items to the stack that don’t get removed until that function is completed (goes out of scope).
The stack keeps simple values and pointers to the heap for more complex / larger objects.
Scoped variables are held in a stack, which has a finite amount of space.
In regards to memory there is the heap and the stack.
Space, in this regard, could be memory, disk, or any streaming, such as over a network or to another device.
Space complexity is about describing where the data used in an algorithm is stored.
Time complexity allows us to describe how long an operation will take.
If you keep adding loops for every item added, you’re now into O(n!) territory and should quickly find a way out!.
List iterations that also use divide and conquer are O(n log n).
Divide and conquer are O(log n) – dividing lists into smaller sets is logarithmic.
Nested list iterations are O(n^2) or worse.
Data structures play a key role here, dictionaries, hash tables, etc.
Random access to an item is always O(1).
Save time by logging into every website with a single click.
#ROBOFORM VERSIONS PASSWORD#
RoboForm can also import your passwords from a CSV or even another password manager! We don’t store your Master Password anywhere, so make sure you don’t forget it!ÄȘdd your passwords manually or have them save automatically as you log in to your online accounts. Your Master Password is the one password you’ll need to remember. This allows you to sync your data between your desktop and mobile devices.
#ROBOFORM VERSIONS INSTALL#
With Easy Steps:Ä­ownload and install RoboForm, and create a RoboForm account with just an email address. To protect your data, RoboForm uses AES-256 bit encryption with PBKDF2 SHA-256. Shop Online? With one click, RoboForm fills all your address and billing information for you.
#ROBOFORM VERSIONS ANDROID#
RoboForm is available for Windows, Mac, iOS, and Android with support for all their respective major browsers, including Microsoft Edge. Simply enter the receipient’s email and share away. RoboForm password manager securely stores your passwords on your computer and automatically logs you into online accounts. Securely share login information with RoboForm.
#ROBOFORM VERSIONS WINDOWS#
Yes, RoboForm is safe to install on Windows 10.
Tumblr media
1 note · View note
myprogrammingsolver · 3 years ago
Text
Lab 6 Solution
(4 pts) Iteration vs. Recursion You will practice writing and timing iterative and recursive versions of the same function. You will use the following code to time both versions of your solution to the Fibonacci problem described below. #include <iostream> #include <sys/time.h> #include <cstdlib> using std::cout; using std::endl; int main() { typedef struct timeval time; time stop,

Tumblr media
View On WordPress
0 notes
hunter-mw · 3 years ago
Text
On Evaluation
I quite enjoy the evaluation step, where key metrics are observed, and projects either make or break. In the spirit of iterative design philosophy, I think that in some ways, the project doesn’t even truly begin until there are evaluation statistics to consider and a new iteration is in the headlights.
Now that we’re on the tail end of the creative problem solving process as defined by this curriculum, I’m struck by how several of the steps along the way can have a recursive quality - for each step, you can apply the entire process! For this step, coming up with an effective criteria requires ideation, selection, implementation, and then you have to evaluate how effective your criteria were as this chapter itself has described.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Also, for those that disagree with my comments on the “iterate vs. masterpiece” discussion: First of all, I’m sorry that you have to be subjected to my rants on zoom - it’s not easy to convey potentially disagreeable points of view with such haste. Second, I think this subject is one of those things where you can turn the “iterate” dial up so high that it eventually goes all the way around and back to “Masterpiece.”
To continue to take the “David” example for instance... to us, it seems to be a complete masterpiece. It took 26 year old Michelangelo 2 years to carve out of a singular block of marble. Marble was so expensive at the time that it took the government’s special order to just get a block big enough for the commission... meaning, there was zero room for iteration - it was a job only a master could do.
However... to Michelangelo, David was only one in a series the dozens of enormous efforts in master works he created during his lifetime. To a student, impossible, but to him, It was just another iteration (an iteration of his process, not of a singular work). Masters come to the table having iterated and failed more times than an amateur has ever attempted.
This is all to say, that this discussion is one purely of perspective. If iterating is the only means to become a master, and masters are only iterating on their processes, is there even really such a thing as a masterpiece? Is it just a matter of scale? If you’re already comfortable with being a “fierce iterator” where you accept that no design is ever complete... is it so wrong to have the mindset of a master? Is there even a difference between a fierce iterator and a master?
Perhaps what I’m really describing and getting caught on here is the leap from design/pre-production into production/construction... this is a dichotomy that often crosses my mind as a software developer. Iterate a million times in design, so that when it comes time to CREATE the design, you can produce that masterpiece. In this example, the students are kind of designing and creating at the same time.
In the spirit of this chapter on “Evaluation,” the criteria for success makes such a difference here. I think that in a vacuum, the ceramic students trying to produce an arbitrarily “high quality” ceramic via constant iteration may create the most commercially viable, most structurally tested, most mass-appeal, most generically applicable ceramic... but it is not likely that they create the most provocative, most illustrious, most unique, most full-scale, most detailed, most emotional... etc. Those types of qualities arise from masterful vision, pre-meditation, and singular execution.
At the end of the day, this program is about divergent thinking. That means rejecting certain established truths - in my mind, that absolutely includes this curriculum. I don’t hesitate to find valid opposing points for platitudes like the “masterpiece vs iteration” ceramics thought experiment.
1 note · View note
felord · 4 years ago
Text
CS1027 Lab9 Solved
Learning Outcomes Design and implement recursive algorithms Design and implement iterative algorithms Compare iterative and recursive approaches to different methods Pre-Lab Create a new Java project called Lab9 Download the file: java Save these downloaded files into the Lab9 src folder   Exercise 1 – Iterative vs. recursive methods   For some problems it is possible to design natural

Tumblr media
View On WordPress
0 notes
blubberquark · 8 years ago
Text
Why comment code?
There is a long-standing tradition of not writing comments in smalltalk programs. Together with many smalltalk language features, this principle has been adapted by parts of the Ruby community. I'm going to paraphrase the motivation behind it like this:
Don't comment your code if you can avoid it. Your code should be simple enough to be easily understood anyway. If not, re-write your code to be easier to understand, and give clearer variable names. Comments can even be actively dangerous if the code gets changed and an old, now incorrect, comment stays the same.
Based on this principle, the first order of business is to make sure your comments are correct and up to date, should you choose to write them. Do not write about irrelevant stuff that is easy to change.
Example: Beginner Code
Compare this beginner Prolog commenting
% increment all elements of a list. incr_all([],[]). % base case incr_all([H|T],[N|NT]) :- N is H+1, incr_all(T,NT). % Prolog has no for loops, so we must use recursion % Also important to use is instead of = to force eval % is does not work if H is not grounded
to this veteran code:
%% incr_all(++List, -ListOut) is det % increment elements of List incr_all([],[]). incr_all([H|T], [N|NT]):- N is H+1, incr_all(T,NT).
Did you ever write something like this in C or Java when you were just starting out?
x = x+1; //increment x by one //so we get to the next element //in the next loop iteration
Beginner comments are written from the perspective of explaining the programming language, or explaining how you program. Beginners don't think they will forget what their own program does, but that they will forget what the computer will do with it. Veteran comments explain the intention program, assuming that the reader will understand what each individual line of code does, but not why it is there in the first place.
A similar thing happens in beginner TDD. You write a bunch of tests that test other people's code.
@Test public void testUserSave() { //This is pseudocode based on Java syntax! Schema schema = new com.yoyodyne.foobar.ApplicationSchema(); DatabaseORM orm = new SPAMDatabaseORM("postgresql://FOOBAR", schema)); User user = orm.createUser("John Doe", "[email protected]", "secretpassword"); user.save(); User user2= orm.getUserByName("John Doe"); assertEquals(user, user2); }
It is a good idea to write minimal examples to see that you understand how to use an API, but as a Unit Test, this is dangerously misleading. It is a test that always succeeds - and gives you a nice green number of successful tests in your console output-, because it tests a dependency that is unlikely to change, and not any code of your own.
Example: Old Game Code
We wrote a game for a 3D graphics class once. It was written in C++, using a rendering engine that used a reference counting template (smart pointers) for all of its game objects. Somewhere in the game logic, we had this procedure (roughly, I'm writing this from memory):
void move_to_graveyard(ref_ptr gobj) { graveyard->append(gobj); gobj->getParent()->removeChild(gobj); }
And in the Bullet class, we had a callback method that would be invoked by the physics engine if a bullet hit a monster.
void on_collide(*the_monster) { the_monster->hurt(this->damage); if (the_monster->getHealth() < 0.0f) { move_to_graveyard(ref(the_monster)); } move_to_graveyard(ref(this)); }
The physics engine did not use smart pointers internally. If we tried to remove a bullet from the scene graph while the collision detection code was still running, the reference count of the bullet would drop to zero, and the memory would be automatically freed. The same went for monsters. Sometimes a monster would be hit by two bullets during the same frame, and in that case, if we removed it from the scene graph the first time, the second time the on_collide method would be called with a dangling pointer argument, as would the rest of the collision handling code.
Nowadays I can instantly think of two or three different ways to solve this problem, but the graveyard was a quick and dirty hack to avoid a segmentation fault.
I commented this code:
/* This is called during on_collide, because we can't remove gobj from the scene graph during collision detection due to smart pointer refcount problems */ void move_to_graveyard(ref_ptr gobj) { ...
My classmate also commented this code
/* Take a reference to a GameObject, remove the GameObject from the scene graph, and append it to the graveyard list */ void move_to_graveyard(ref_ptr gobj) { ...
Because obviously, you don't want to write "HACK:" in the code you turn in for a class project. You want it to look professional and tested. Our professor had told us to document what code actually does, not what the call site does. My writing this comment was clearly an opportunity for our TA to grade our project worse. What if the call site changes and this comment becomes untrue?
Instead of leaving this be, we tried to do the right thing based on all the software engineering rules we knew. We could have named the function differently, or copy-pasted the body of the procedure to the handful of call sites that dealt with the graveyard.
As long as we dotted every i and crossed each t, we were free to write code that was completely unmaintainable in the long run, because there was no long run beyond the day we handed in our assignment.
So we split the difference and commented all the call sites, and documented not when move_to_graveyard is called, but when it should be called. And then we changed the code and made the whole graveyard thing a lot simpler, and removed the comments.
What vs. Why?
There are two major philosophies of documenting code. The first I would call "what does this do?"
In the what philosophy, you document your code in a rather straightforward way. In terms of comments, less is usually more: It's always better to have expressive variable, type and procedure identifiers than to have cryptic identifiers and verbose comments.
The other philosophy is "why is this here?"
You cannot apply the why philosophy to all software projects in the same way, and not on the same scale as the what philosophy. Libraries and frameworks have different requirements for documentation compared to applications. For a library, you should probably document what the public API is good for, and how it should be used.
User-facing applications probably have much higher coupling and less reusability, and need a different kind of documentation. Still, it is better to answer the non-obvious questions, and to document the design decisions that can't be answered by running a debugger.
Games often have higher coupling and lower cohesion (unless you use an entity-component-framework) compared to application software. You don't want to update existing games with new game mechanics five years down the line the same way you would add features to application software, so you can usually get away with it.
If your program already has expressive identifiers and understandable code, the marginal value of inline comments and class diagrams might be dwarfed by the value of documenting the high-level struckture, or pointing out the counterintuitive hacky bits.
Martin Fowler on mocking in unit testing
more on why not to mock
Steve Yegge on newbie code comments
13 notes · View notes
yung-gini-blog · 6 years ago
Text
Word Is Bitcoin
The Private Key:
Businesses and leaders ask “Why Bitcoin?”
The answer is “why not!”
Truth is: bitcoin is a conundrum. A mystery. A black box. Bitcoin devastates our natural tendency towards metaphor and simile. Bitcoin is not this or that, it is all of it and nothing at all, simultaneously. Bitcoin is like a text; it's akin to a work of fine art in its wisdom and collectibility. And crucially, what Bitcoin is is not determined by any singular human authority.
Bitcoin exists, and that is all that can be said definitively. Bitcoin cannot be stopped. This I say confidently. Its will to be exceeds that of any human machine.
This book is dedicated to all the enterprises, executives, investors, and sovereigns on the path of success...To those who are fed up, who have watched it happen again and again and know now is the time to jump in and go with the flow...To those who are not “early adopters” but who understand the importance of timing, if you wish to stop reacting to the accelerating waves of disruption and begin to embrace the technologies that are reshaping capital markets, redefining the best practices for efficient operations of complex systems, reimagining planet Earth as a space of shared prosperity, and accelerating the evolution of consciousness...To those who are curious and hopeful, why I write this book is well understood.
  I.
1) Stop Reacting:
Inspect the state of the global economy.
Characterize the paths of success in the world that is
Industry
Stocks and bonds (equity and debt)
Options and Futures (equity derivatives)
Swaps and CDOs (debt derivatives)
Location, Location, Location (real estate 4 dummies)
Finance
Pensions → Corporates → Endowments (AUM, dumb to smart managers)
Value Investing → Prop trading → Market Making (money makers, slow to fast)
Family Offices → Sovereigns → Banks (power players, small to big)
VC → PE → Hedge Fund (fee structures)
Internet
“Software eats the world” (technofuturism is obvious for nerds)
Automation and DevOps (data is an asset and algorithms are leverage)
Intellectual property (is software)
Copyleft and Open Source (ethical capitalism aka skilled labor retention)
2) Begin to Embrace:
Startup Culture
Small teams (Bezos' “2 pizza rule”)
Generalists over specialists
Equity ownership
The Startup Grind (hussle harder)
Growth
Everything grows at its own natural rate. To go beyond the natural, consider doping the hormones of your enterprise with the equivalent of steroids for corporate finance.
Hacking (RTFM, kid)
The codes are Open Source. Read the documentation and test it like your security depends on it.
Growth Hacking (click funnels, content marketing, ads, persuasion)
Mind Hacking (meditation, psychadelics, affirmations)
Social Hacking (politics, persuasion, persistence)
Consistency
Principles (values, virtues, patterns, and Truth as you know it)
Open-mindedness (eager acceptance of imperfection and continuous detachment from self-conceptions)
Alternatives [Illustrate the futility of avoiding money or searching for an alternative to Bitcoin. Perhaps Criticism deserves its own section in Stop Reacting.]
Lifestyle business (requires social media Growth Hacking skills)
Art and collectibles (nostalgia, or “authentic culture is the ultimate asset in a world of abundance”)
Asceticism (ie orthodox religion)
Intellectualism (ie Marxism)
II.
1) Capital Markets:
Disintermediation
Automation and competition over transaction execution lowers fees towards zero (over time)
Tokenization
Assets are standardized for exchange online
24/7 365 global market access
Liquidity
Markets in everything (gambling is a sport)
Dark net markets in everything (Panic or Paradise?)
Money In Politics
Tax havens/finance hubs and jurisdiction shopping
Trade War (Is Bitcoin uncorrelated?)
Audit-ability and the emerging “Anticorruption movement” (not a thing but can we make it a thing?)
2) Operational Efficiency:
Automation
Deep Learning (same silicon as mining, overlapping developer labor pool)
DevOps (continuous integration)
DevSecOps (automated threat monitoring)
Robots
3D Printing
Process Engineering
Co-located teams are Agile (the cult of Daily Standup)
Distributed teams are Remote, Flexible, and Aligned
Remote (work from home or bring your work home?) [contrast with megacorp campuses with perks like “free” doggie day-care]
Flex-time (cultivating freedom mentality in creative knowledge workers)
Incentive Alignment (greasing the gears) [contrast with Principal-Agent Problem]
Data is an Asset Class
Software systems ingest and log data
Logged data from enterprise systems is fed to AI
Blockchains are public data sets, enriching and nourishing today's baby AIs
3) Planet Earth:
Climate Crises
Mining carbon emissions are a problem and technological civilizations solve problems
Increased demand for energy stimulates market for solar and other renewable energy tech!
Solving climate crisis requires global cooperation
Global cooperation implies increased globalization
Wildlife Conservation
Nature is the ultimate inspiration of art, and art is priceless
Cultivating nature is a component of life well-lived
Disregard for nature is contemptible to the Bitcoin Rich
4) Evolution:
Nature and Conscious Nurturing
Education technology is the only better industry than enterprise fintech. Invest in innovative methods to inform current and future generations.
Synthetic biology is the only science more important than computers (physics is the intersection of computer science and math in today's academy).
Reinvention
Success comes with repetition. Good ideas deserve persistence. Bitcoin is not original, but it is different.
Embrace change by appropriating software techniques like iteration and recursion to accelerate your lifecycles. (A lifecycle is an instance of the {do, receive, think, state} mental loop. [Elaboration on this will come later])
The Collective Unconscious
Common dreams are hard to come by. Don't bet against them; join in or standby.
Money is intellectual energy, it's presence felt but hardly seen; it's message heard but sound not made.
The mentality that Bitcoin imparts on the world is one of self-reliance, entrepreneurship, reinforcement of the Truth that ideas matter, and appreciation of the wonderful unknown.
Something Old, Something New
Sharia 101: Intro to Islamic Finance
The Problem of Riba (similar to usury)
Bitcoin is Halal
Orthodox Jews love it too
AI algorithms can transact autonomously, without human or corporate identity
Bitcoin: an engine of globalization and cross-cultural pollination
Soul Contracts
“In the beginning was the word” [John 1:1]
“Be impeccable with your word” [Don Miguel Ruiz]
“Word is bond” [5% Nation of Gods and Earths]
Do you believe in destiny, fate, karma, or justice? If you knew with certainty that all of your actions and moods and mental states were under constant surveillance by a superintelligent entity, how would you live? Do you have any sacred rituals or objects? What makes them special in your eyes? The answers to these questions are where fortune resides.
Appendix A:
Cybernetics [Weiner, Maltz]
Neuro-Linguistic Programming
Natural Language Processing
Databases, relational algebra, Structured Query Language
Distributed systems, security, fault tolerance
Distributed Denial of Service, Byzantine Fault Tolerance, Proof of Work
Proof of Stake and the future (sharding, data chains, interoperability, dapps, etc.)...
What is Blockchain technology? Immutable Record-keeping, Smart Contracts, and Notes on Historiography (a collection of political economy book reviews in light of Blockchain) [this part is a kind of hedge for the educated “Blockchain not Bitcoin” reader]:
Fukuyama's The End of History, about the triumph of liberal democracy, vs.
Davidson's The Sovereign Individual, about thriving during the collapse of the Welfare State;
Keynes' The General Theory of Employment, Interest and Money, about spending your way out of a recession vs.
Hayek's The Road to Serfdom, about easy money and debt traps;
Smith's The Wealth of Nations, about capitalism, vs.
Marx' Das Kapital, about capitalism
Taleb's Fooled By Randomness, about unfairness, vs.
Piketty's Capital In The 21st Century, about unfairness.
  This is a base structure from which to iterate into a full-length book. The structure serves the function of establishing context inside which an argument is made persuasively. The proposition is that “Bitcoin is the Index Fund of the Internet”. By Internet, I mean a global computer network. Today, if you want to invest in Enterprise SaaS (perhaps the industry with the most investable companies), you are limited by your dealflow. Dealflow is usually regionally segregated, in that you must be closely connected to a company's founding team to be an early-stage investor.
As the new wave of post-global communications networks, (permissionless) Blockchain technologies deliver access to liquid markets to anyone who can operate a phone. In the long term, markets create prosperity. But in the short term, markets often have shocking effects.
The problem of markets is that there are too many choices. A perfect capitalist economy has everything up for sale always. So how could anyone know with certainty that they have bought the right goods? How often do you allocate resources only to discover that your energies are better focused elsewhere? The entire purpose of advertising, marketing, sales, and politics is to convince people to make decisions that wouldn't otherwise occur to them. We live in a world awash in persuasion, and it's increasingly difficult to stand outside of the social field.
In order to make this book real, a great deal of research is to be done, including 8 book reports (plus reviews of Krawisz' Hyperbitcoinization and Carter's Visions of Bitcoin). Furthermore, the entire Western economy must be diagrammed so that the central banking Ponzi is revealed. I believe it is best to adopt an approach of subtlety, perhaps leaving the investigation of some details about the fraud in the non-profit sector as an exercise for the curious reader (think multinational NGOs like IMF and World Bank). Some things, like verbal evisceration of banksters, sound better coming from Elizabeth Warren or Alexandria Ocasio-Cortez.
It is not necessary to be maximally critical of the powers that be; Bitcoin is itself a diplomatic technology. One of Bitcoin's intangible qualities is that it serves as a vehicle for education. Bitcoin is the incentive for a movement of self-education in technology and markets, and it is wonderful that such a thing exists while so many young people are six figures deep in debt to a university system that doesn't prepare them for the working world, a world dominated by financial technologies.
I hope that the arc of the book flows from solid matter (industry) to bits of data (finance) to soul vibration (sovereignty). In the process, the reader takes a journey of self-discovery. If one's outlook coming into the book is to learn how to transform your business with Bitcoin and get rich, one's outlook going out should be how to accept the blessings of fortune and live a dignified life.
  Original Text by Yung Gini. The reader is free to use this text or the ideas therein in any way shape or form, and to engage Gini in open-ended negotiations in pursuance of a book-making contract, accepting that Gini expects no greater than 21% share of book revenues, and thus intends to impart no greater than 21% of book-writing efforts, as his passion is Construction with bits, not Explanations in ink.
As one who believes that books are being outmoded in favor of voice-based digital media (which can be optionally transcribed into book format for old-school readers), I look forward to recording and streaming conversations that cover any of the aforementioned points in depth enough to tickle my mind and edify the audience.
1 note · View note
udemy-gift-coupon-blog · 6 years ago
Link
JavaScript Core fundamentals - Learn JavaScript Here ##realdiscount ##UdemyFreeCourses #Core #Fundamentals #JavaScript #Learn JavaScript Core fundamentals - Learn JavaScript Here Learn JavaScript Language Fundamentals and start coding JavaScript Today. Source Code is included so you can try the code. Resources and tips are provided throughout the course when appropriate. Modern JavaScript focused means that we do cover current syntax as well as foundational code.  No frameworks or JavaScript libraries you can do it all with regular vanilla JavaScript. All you need is a browser to see JavaScript in action and with a few lines of code you can do a whole lot.  It’s easy let us show you. Course covers Setup you working development environment and get ready to write some code. What JavaScript is and how code works.  Tools and resources used to write JavaScript How to create JavaScript Code and run it in your browser Comments and debugging with the console Variables and how to create and store values in code Declaring variables assigning values Using let and const as variables Strings Numbers and Boolean data types Other data types null, undefined Best practices and rules to name variables Using JavaScript windows methods alert and prompt Creating template literals Challenge #1 Using Template literals in code JavaScript type conversion and how it works JavaScript Operators Comparison and Assignment operators Challenge #2 to create a Miles to Kilometers Converter Truthy or Falsy JavaScript Conditions if else statements JavaScript Conditions else if statements Using Short ternary operator Conditions with Multiple conditions and logical operators Challenge #3 - Hello Greeter JavaScript Switch statement JavaScript Functions JavaScript Functions arguments and default values JavaScript Functions return values JavaScript click events on elements Function declaration vs expression Function scope global vs local Function recursion IIFE (Immediately Invoked Function Expression) ES6 Arrow format JavaScript Objects Object Method and const Functions to create Objects JavaScript Arrays Array methods to do more with arrays Array filter JavaScript Loops and iteration forEach, object and array data Challenge #4 - Loops Array builder JavaScript Map No libraries, no shortcuts just learning JavaScript making it DYNAMIC and INTERACTIVE web application. Step by step learning with all steps included. Beginner JavaScript knowledge is required as the course covers only JavaScript relevant to the building of the game.  Also HTML and CSS knowledge is essential as scope of this course is all JavaScript focused.   Along with friendly support in the Q&A to help you learn and answer any questions you may have. Try it now you have nothing to lose, comes with a 30 day money back guarantee.   Start building and coding with JavaScript today. Who this course is for: Beginners to JavaScript Web developers HTML and CSS coders 👉 Activate Udemy Coupon 👈 Free Tutorials Udemy Review Real Discount Udemy Free Courses Udemy Coupon Udemy Francais Coupon Udemy gratuit Coursera and Edx ELearningFree Course Free Online Training Udemy Udemy Free Coupons Udemy Free Discount Coupons Udemy Online Course Udemy Online Training 100% FREE Udemy Discount Coupons https://www.couponudemy.com/blog/javascript-core-fundamentals-learn-javascript-here/
0 notes