SVET PROGRAMIRANJA
  • HOME
  • WEB PROGRAMMING
    • Popular programming languages today
    • Programming trends
    • Internet of things
    • Creating web application
    • Frontend and backend programming
    • Creating Simple Website >
      • Create Your Logo Home
      • Create Your Logo CSS
    • Creating python web application >
      • Creating a Django Web Application - Getting Started
    • ASP.NET CORE web application >
      • ASP.NET CORE web application introduce >
      • Servicing static web pages using a web server
      • Creation of a sql web api service that reads data from the database
      • Creating a controller in an asp.net web API application
      • Communication of the Javascript web application with the API server
  • Algorithms
    • Algorithms Guide
    • Mathematical algorithms >
      • Array of Fibonacci
      • A prime numbers and factoring
      • Eratosthenes sieve
      • The Euclidean algorithm
      • The maximum sum of subarrays
      • Fast exponentiation algorithm
    • Structures and Unions >
      • Introduction to structures and unions
      • Disjoint Set Union (DSU) structures
      • Basic data structures
    • Sorting arrays >
      • Merge-sort
      • Quick-sort
    • Binary search
    • Recursion and dynamic programming >
      • Recursive algorithms
        • Tower of Hanoi algorithm
      • Introduction to dynamic programming
      • DP: Fibonacci with memoization
      • DP: Knapsack problem – Explanation and examples
      • Longest Common Subsequence (LCS)
  • Examples in C,C++,Java
    • Basic Examples >
      • Data examples in C/C++
      • Selection statements in C/C++ - examples
      • Loops in C/C++ examples >
        • Loops in C/C++ examples basic
        • Nested loops in c and c++ examples
      • Arrays in C/C++ examples
      • Strings in C/C++ examples
      • Sorting arrays in C/C++ examples
      • Two dimensional arrays in C/C++ - examples
      • Functions in C/C++ - examples
      • Algorithms examples >
        • Recursive algorithms examples
    • Additional examples with solutions >
      • Data in C - additional examples
      • Selection statement - additional
      • Loop - additional
      • Clasess and objects- additional
    • Preparations for competitions in informatics >
      • Preparations for qualifications for distict competitions
      • Qualifications for distict competitions
      • Preparation for the national competition
    • Tests >
      • Test from "Selections statements"
  • Programming languagages
    • Learn C >
      • Introducing to C and C++
      • Basics about C and C++
      • Data in languages C
      • Operators in C/C++
      • Selection Statements in C/C++
      • Loops in C/C++ >
        • Loops in C/C++ basic
        • Nested loops in c and c++
      • Arrays in c and cpp >
        • Onedimensional Array in c and c++ basic
        • Vectors in c and c++
        • Two-dimensional array-matrix in c and c++
        • Maps in c and c++
      • Strings in C/C++
      • Two-dimensional arrays
      • Pointers in C/C++
      • Functions in C
    • learn C++ >
      • Introducing to C++
      • Data in C++
      • Operators in C++
      • Selection Statements in C++
      • Loops in C++ >
        • Loops in C++ basic
        • Nested loops in c++
      • Arrays in c++ >
        • Introduction to an Array in c++
        • Vectors in c++
        • Two-dimensional array-matrix in c++
        • Maps in c++
        • Two dimensional dynamic arrays in c++
      • Strings in C++
      • Two-dimensional arrays
      • Pointers in C++
      • Functions in C++
    • Learn JAVA >
        /*JAVA*/
      • Introducing to JAVA
      • Java Basic >
        • Data in JAVA programming
        • Selections statements in JAVA
        • Operators in JAVA
        • Loops in JAVA
        • Arrays in JAVA
      • Object oriented programming >
        • Understanding Java as an Object-Oriented Language
        • Classes and Objects
        • Inheritance of classes
        • Abstract classes and interfaces
        • The visual part of the application >
          • Graphical user interface
          • Events in Java
          • Drawing in window
          • Graphics in JAVA-example
          • Animations in JAVA-examples
          • Applications in JAVA-examples
      • Distance learning java
    • Learn Processing >
      • Intoduction to processing
      • Basic of processing using JAVA
      • Processing and microbit
      • Using vectors in Processing >
        • Vector operations application
      • Processing 2D >
        • Creating Projectile motion animation
        • Processing example: Soccer game shoot
        • Body sliding down a inclined plane
        • Analisys of an inclined plane
        • Circular motion animation in processing
      • Processing 3D >
        • Introducing to 3D processing
        • Movement of 3D objects in processing
    • Arduino and ESP32 programming >
      • Learn Arduino Programming >
        • Intoduction to arduino
        • LDR sensor(light sensor) exercises
        • Arduino temperature sensor - exercises
        • Measuring an unknown resistor
        • Arduino -Ultrasonic sensor
        • introduction to servo-motors on arduino
        • Moisture soil sensor
      • Learn ESP32 Programming >
        • Intoduction to ESP32
        • ESP32 with servo motors exercise
  • MORE
    • Privacy Policy
    • Links
    • Distance learning

Srpski | English

RECURSION ALGORITHMS- EXAMPLES

Introduction to recursive algorithms

Recursion is a powerful concept in programming that allows functions to call themselves within their body. This approach is often used to solve problems that can be broken down into smaller, similar subproblems. Recursive algorithms are extremely useful in many areas, including mathematical calculations, searching and sorting data, and for solving complex problems that have natural tree or graph structures.

What is Recursion?

Recursion occurs when a function calls itself to solve a smaller part of the problem. Every recursive function must have a base case that stops further calls, and a recursive case that decomposes the problem into smaller parts. The key to successfully implementing recursion is to design the function in such a way that it handles the base case correctly and handles the recursive cases efficiently.

Advantages of Recursive Algorithms

  • Simplicity: Recursion can simplify code for complex problems that would be more difficult to understand and implement in an iterative version.
  • Elegance: Many natural and mathematical structures (such as trees and graphs) are naturally represented recursively.
  • Modularity: Using recursion can help organize code in a modular and readable way.

Practical application

On this page you will find tasks that use recursion to solve various problems. From simple tasks such as calculating the power of a number and adding natural numbers, to more complex challenges such as finding permutations and working with matrices. Each assignment is designed to help you improve your programming skills using recursion.
Before you start solving the problems, we recommend that you study the basic concepts of recursion to better understand the approaches and techniques you will need. Good luck with the solution!

Before you start solving the tasks, read the lesson on the page: Recursive algorithms

1. Degree calculation Xn

Write a program that uses recursion to solve degrees Xn

Input: The real number x (0.8 ≤ x ≤ 1.2) and the integer n (0 ≤ n ≤ 20) are entered from the standard input.
Output:

Write a value to the standard output Xn zaokruženu na 5 decimala.

Example:

Input:
1.1
5

Output:

1.61051
Solution: The task is explained in detail on the webpage: Recursion algorithm
 Recursive Algorithms: y= X ^ n
Figure 1: Recursive Algorithms: y= X ^ n

2. First and second in the rankings

​N participants participated in the athletic competition. At the end of the competition, the results are summarized and a list is formed
 in non-increasing order by the number of getting points , from the highest to the lowest number of points scored. Write a program
which determines the number of points of competitors who are first and second on the ranking list.
Input:

The first line of the standard input contains a natural number N (1 ≤ N ≤ 20000) which represents the number competitors. In each of the next N lines there is an integer from the interval [0, 20000], these numbers represent points of competitors, which are not sorted.

Output:

One line of standard output shows the number of points of the first and second competitor on the ranking list.

Example:

Input:
5
70
95
75
30
99

Output:

99
95
Solution

3. Writing numbers inversely and directly

​Write a recursive function that prints numbers from 1 to n in inverse and direct order.​

4. Adding numbers recursively

Create a function that sums the first n natural numbers recursively. In the main method, enter n and call a recursive function to calculate the sum of those numbers.

5. Number of permutations

Enter an integer n, then determine the number of permutations of n elements, using recursion

6. The Fibonacci array

​Enter an integer n and then print the Fibonacci sequence of n elements using recursion. Determine also the sum of all those elements.

7. From decimal to binary form

Write a recursive function that prints the natural number written in decimal form n in binary form in direct order.
Example 1:
Input
22
Output
​0000 0000 0001 0110
Example 2:
Input
2147483647
Output
​1111 1111 1111 1111

8. The number of squares cut by the diagonal

​A rectangle whose width and height are m[cm] and n[cm] respectively is composed of m*n squares whose sides are 1 cm each. Create a program that, using recursion, determines how many squares will be intersected with the main diagonal of that rectangle.
Example:
Input
5
3
Output
7
Recursive functions: The number of squares cut by the diagonal of the rectangle that contains them
Figure 1: Recursive functions: The number of squares cut by the diagonal of the rectangle that contains them

Solve the task according to the following algorithm:

  • Enter two integers representing the length and width of rectangles a and b
  • Divide the rectangle into squares of side 1 cm, so that the rectangle looks like a chessboard with b columns and a rows.
  • Determine the coefficient of the diagonal direction as the tangent of the angle (ratio of the width and length of the rectangle b/a)
  • Create a recursive function that returns the number of squares cut by the diagonal of the rectangle
  • Pass the function the initial value of the length of the rectangle, the maximum value of the ymax coordinate in the first column of the square, as well as the direction coefficient.
  • Inside the function, set the passed value for ymax to be ymin now. Determine ymax based on the kednac line ymax = ymin + k*1, where k is the coefficient of the direction transferred as a parameter, and 1 is the length of the side of the square.
  • Inside the function, also, determine the smallest integer value less than the minimum and the smallest integer value greater than the maximum ymax,
    determine the number of squares cut diagonally only in the current column and add it to the total number of squares cut in the following columns.
    This number is obtained by calling the same recursive function again when obtaining the same return value.
  • Do this calculation under the condition that the number of remaining columns is greater than 1
  • In each subsequent call to the recursive function:
    • Reduce the remaining number of columns by 1
    • the maximum value in the current recursion should become the minimum value ymin for the next recursion

/* Solution in programming language C */

#include < stdio.h>
#include < math.h >

int brkv(float n, float ymin, float k)
{
int x;/*the number of intersected squares in the current column*/
int a,b;
float ymax=ymin + k; /*y=k*x*/
a=floor(ymin); /* the first smaller integer */
b=ceil(ymax);/* the first larger integer */
x=b-a;
if(n > 1)
x = x + brkv(n-1, ymax, k); /* What is ymax here will be ymin in the next one */
return x;
} int main()
{
float a,b,k;
scanf("%f%f",&a,&b);
k=b/a; /* coefficient of the direction of the diagonal, i.e., the tangent of the angle that overlaps the diagonal with the side of the rectangle*/
printf("%d",brkv(a,0,k));

return 0;
}

9. Fast scaling algorithm

Write a recursive function to quickly calculate the power of some number: Xn
​Enter an integer n and use the function to calculate the said power.

10. Solitaire

A solitaire of n floors should be whitewashed under the following conditions:
  • each floor is painted either white or blue
  • there must not be 3 white floors one above the other.
In how many ways can one nth floor be painted?

11. Inverse matrix

Enter n and then load a matrix of order n*n. Create a program that calculates the determinant of that matrix and its inverse matrix.
Example: 
Input
3
3 5 6
2 -6 3
0 1 7
Output
-193
Solution:
Working with matrices is explained in detail on the website: Two dimensional array-matrix
Calculating the determinant of the matrix is ​​explained in detail on the web page: Recursive Algorithms

The complete solution is explained on the website:

Recursive Algorithms

/*Determines the determinant of the matrix a C*/

#include < stdio.h >
#include < stdlib.h >
#include< math.h >

/*Determining the determinant of the matrix a
parameters:
a-matrix initial n*n
n-dimensional square matrix
r-row to expand the matrix or -1 if not expanded by row
c-column to develop the matrix or -1 if not developed by column
rowP-sequence of crossed out rows in matrix
colP-array of crossed out columns in matrix
*/
float ** inverse(int ** aT, int det, int n)
{
float **aI;
aI = (float **)malloc(n*sizeof(float*));
for(int i=0; i < n; i++)
{
aI[i]=(float *)malloc(n*sizeof(float));

for(int j=0; j < n; j++)
{
aI[i][j]=(float)aT[i][j]/det;
}
}
return aI;
}

int ** copyMatrix(int ** aT, int n)
{
int **aC;
aC = (int**)malloc(n*sizeof(int*));
for(int i=0; i < n; i++)
{
aC[i]=(int*)malloc(n*sizeof(int));
for(int j=0; j < n; j++)
{
aC[i][j]=aT[i][j];
}
}
return aC;
}
void transposed(int ** a, int n)
{
for(int i=0; i < n; i++)
{
for(int j=i; j < n; j++)
{
/*swap*/
int b=a[i][j];
a[i][j]=a[j][i];
a[j][i]=b;
}
}
}

void printMatrixF( float ** a, int n)
{
for(int i=0; i < n; i++)
{
for(int j=0; j < n; j++)
{
printf("%.2f ",a[i][j]);
}
printf("\n");
}
}

/*Function to print matrix
* parameters are
* a- pointer to matrix(pointer to pointer)
* n -dimensional matrix
*/
void printMatrix( int ** a, int n)
{
for(int i=0; i < m; i++)
{
for(int j=0; j < n; j++)
{
printf("%d ",a[i][j]);
}
printf("\n");
}
}
/*Determines the determinant of the matrix a
parameters:
a-matrix initial n*n
n-dimensional square matrix
r-row to expand the matrix or -1 if not expanded by row
c-column to develop the matrix or -1 if not developed by column
rowP-sequence of crossed out rows in matrix
colP-array of crossed out columns in matrix
*/
int determinant(int ** a,int n, int r,int c,int size, int * rowP, int * colP)
{
int res=0;
if(size==1)
{
int i=0,j=0;
while(rowP[i])
{
i++;
}
while(colP[j])
{
j++;
}
res=a[i][j];
}
else
{
int k=1;
if(r!=-1 && c==-1) //if the determinant develops in order
{
int pom=n-size;//reducing the number of observed rows in the original matrix
while(rowP[r]){
r++;
}
r=r%n;//correction if r > n
for(int j = 0,t = 0; j < n; j++)
{
if(colP[j])
{
continue;
}
k=(int)pow(-1,(r-pom+t));//the coef of the cofactor(1 ili -1)
colP[j]=1;//a crossed out column in a large matrix
rowP[r]=1;//a crossed out row in a large matrix

/*A recursive call to the same function*/
int d=determinant(a,n,0,-1,size-1,redP,colP);
printf("red %d, col %d: %d * %d * %d\n",r,j,k,a[r][j],d);
res=res+k*a[r][j]*d;
colP[j]=0;//returned crossed out column in large matrix
redP[r]=0;//returned crossed out row in large matrix
t++;
}
}
else if(c!=-1 && r==-1)
{
int pom=n-size;//reducing the number of observed rows in the original matrix
while(colP[c]){
c++;
}
c=c%n;//corection if r>n
for(int i=0,h=0; i < n; i++)
{
if(rowP[i])
{
continue;
}
k=(int)pow(-1,(c-pom+h));//coeficijent of the cofactor(1 ili -1)
colP[c]=1;//a crossed out column in a large matrix
rowP[i]=1;//a crossed out row in a large matrix
int d=determinant(a,n,-1,0,size-1,rowP,colP);
printf("red %d, col %d: %d * %d * %d\n",i,c,k,a[i][c],d);
rez=rez+k*a[i][c]*d;
colP[c]=0;//returned crossed out column in large matrix
rowP[i]=0;//returned crossed out row in large matrix
h++;
}
}
else /*Error*/
{
printf("Error");
return -1;
}
}
return res;
}
void adjuvanted(int ** a, int n)
{
int **aA;
aA= copyMatrix(a,n);
int k=1;

for(int i=0; i < n; i++)
{
for(int j=0; j < n; j++)
{
int * colP=(int*) malloc(n*sizeof(int));
for(int i=0; i < n; i++)
{
colP[i]=0;
}
int * rowP=(int*) malloc(n*sizeof(int));
for(int i=0; i < n; i++)
{
rowP[i]=0;
}
rowP[i]=1;
colP[j]=1;
int cofA;
cofA=determinant(aA,n,0,-1,n-1,rowP,colP);
k=(int)pow(-1,(i+j));
a[i][j]=k*cofA;
free(rowP);
free(colP);
}
}
}
int main()
{
int n;
int **A;
float ** AI;
printf("n=?\n");
scanf("%d",&n);
A=(int**)malloc(n*sizeof(int*));
printf("Matrix?\n");
for(int i=0; i < n; i++)
{
A[i]=(int*)malloc(n*sizeof(int));
for(int j=0; j {
scanf("%d",&A[i][j]);
}
}
printf("Matrix printing:\n");
printMatrix(A,n);
int * colP=(int*) malloc(n*sizeof(int));
for(int i=0; i < n; i++)
{
colP[i]=0;
}
int * rowP=(int*) malloc(n*sizeof(int));
for(int i=0; i < n; i++)
{
rowP[i]=0;
}
int d=determinant(A,n,0,-1,n,rowP,colP);/*parameters: matrix n*n(A), the order in which it will be developed,
column=-1 means that it does not develop by column, a series of crossed-out rows, a series of crossed-out columns*/
free(colP);
free(rowP);
printf("Determinant(A): %d\n",d);
if(d==0)
{
printf("Matrix is singular");
return 0;
}
transposed(A,n);
printMatrix(A,n);

printf("Adjuvantedmatrix A:\n");
adjuvanted(A,n);

printMatrix(A,n);
AI=inverse(A,d,n);
printMatrixF(AI,n);
return 0;
}

Optimizing Recursive Algorithms

Recursion is a powerful tool in algorithm design, but it often comes with inefficiencies such as redundant calculations and high memory usage due to deep call stacks. This section focuses on optimizing recursive algorithms through memoization and conversion to iteration, providing practical insights for advanced users.
1. MemoizationMemoization involves storing results of expensive function calls and reusing them when the same inputs occur again. This optimization is particularly useful for problems with overlapping subproblems, such as the Fibonacci sequence or dynamic programming algorithms.

Example: Fibonacci Sequence with Memoization

Java

import java.util.HashMap;

public class Fibonacci {
    private static HashMap<Integer, Integer> memo = new HashMap<>();

    public static int fibonacci(int n) {
        if (n <= 1) return n;
        if (memo.containsKey(n)) return memo.get(n);

        int result = fibonacci(n - 1) + fibonacci(n - 2);
        memo.put(n, result);
        return result;
    }

    public static void main(String[] args) {
        System.out.println(fibonacci(10)); // Output: 55
    }
}

In this example, we avoid recalculating the Fibonacci numbers for the same inputs, significantly reducing the time complexity from O(2n) to O(n).
2. Converting Recursion to IterationWhile recursion provides a clean and elegant solution, converting it to an iterative approach can be more efficient by reducing memory usage. For example, consider transforming a recursive solution for factorial into an iterative version:

Recursive Factorial:

public static int factorial(int n) {
    if (n == 0) return 1;
    return n * factorial(n - 1);
}

Iterative Factorial:

public static int factorialIterative(int n) {
    int result = 1;
    for (int i = 1; i <= n; i++) {
        result *= i;
    }
    return result;
}

​The iterative approach avoids the overhead of recursive calls, making it suitable for systems with limited stack memory.

Advanced Examples

​To challenge learners and deepen their understanding, consider exploring more complex problems:

1. Matrix Determinant Using Recursion

​The determinant of a matrix is an essential concept in linear algebra. A recursive solution breaks down the computation into smaller submatrices:

Java

public static int determinant(int[][] matrix) {
    if (matrix.length == 1) return matrix[0][0];

    int det = 0;
    for (int col = 0; col < matrix.length; col++) {
        det += Math.pow(-1, col) * matrix[0][col] * determinant(minor(matrix, 0, col));
    }
    return det;
}

private static int[][] minor(int[][] matrix, int row, int col) {
    int size = matrix.length - 1;
    int[][] minor = new int[size][size];
    for (int i = 0, r = 0; i < matrix.length; i++) {
        if (i == row) continue;
        for (int j = 0, c = 0; j < matrix.length; j++) {
            if (j == col) continue;
            minor[r][c++] = matrix[i][j];
        }
        r++;
    }
    return minor;
}

2. Tower of Hanoi

​The Tower of Hanoi is a classic recursive problem that involves moving disks between pegs according to specific rules. Here’s the recursive solution:

Java

public static void solveHanoi(int n, char from, char to, char aux) {
    if (n == 1) {
        System.out.println("Move disk 1 from " + from + " to " + to);
        return;
    }
    solveHanoi(n - 1, from, aux, to);
    System.out.println("Move disk " + n + " from " + from + " to " + to);
    solveHanoi(n - 1, aux, to, from);
}

​This problem illustrates the essence of recursion with its divide-and-conquer strategy.

Previous
​|< Algorithms examples
Next
Additional examples with solutions >|

Algoritmi
Matrice
Java
Linkovi
​Politika Privatnosti
Kontakt



© 2025 by Slobodan svetprogramiranja.com

Sva prava zadržana

  • Home
  • WEB APPLICATIONS
    • Popular programming languages today
    • Programming trends
    • Internet of things
    • Creating web application
    • Frontend and backend programming
    • Creating Simple Website >
      • Create Your Logo Home
      • Create Your Logo CSS
    • Creating python web application >
      • Creating a Django Web Application - Getting Started
    • ASP.NET CORE web application >
      • ASP.NET CORE web application introduce >
      • Servicing static web pages using a web server
      • Creation of a sql web api service that reads data from the database
      • Creating a controller in an asp.net web API application
      • Communication of the Javascript web application with the API server
  • Algorithms
    • Algorithms Guide
    • Mathematical algorithms >
      • Array of Fibonacci
      • A prime numbers and factoring
      • Eratosthenes sieve
      • The Euclidean algorithm
      • The maximum sum of subarrays
      • Fast exponentiation algorithm
    • Structures and Unions >
      • Introduction to structures and unions
      • Disjoint Set Union (DSU) structures
      • Basic data structures
    • Sorting arrays
      • Merge-sort
      • Quick-sort
    • Binary search
    • Recursion and dynamic programming >
      • Recursive algorithms
        • Tower of Hanoi algorithm
      • Introduction to dynamic programming
      • DP: Fibonacci with memoization
      • DP: Knapsack problem – Explanation and examples
      • Longest Common Subsequence (LCS)
  • Examples in C,C++,Java
    • Basic Examples >
      • Data examples in C/C++
      • Selection statements in C/C++ - examples
      • Loops in C/C++ examples >
        • Loops in C/C++ examples basic
        • Nested loops in c and c++ examples
      • Arrays in C/C++ examples
      • Strings in C/C++ examples
      • Sorting arrays in C/C++ examples
      • Two dimensional arrays in C/C++ - examples
      • Functions in C/C++ - examples
      • Algorithms examples >
        • Recursive algorithms examples
    • Additional examples with solutions >
      • Data in C - additional
      • Selection statements - additional
      • Loop - additional
      • Clasess and objects- additional
    • Preparations for competitions in informatics >
      • Preparations for qualifications for distict competitions
      • Qualifications for distict competitions
      • Preparation for the national competition
    • Tests >
      • Test from "Selections statements"
  • Programming languagages
    • Learn C >
      • Introducing to C
      • Basics about C
      • Data in languages C
      • Data in C
      • Operators in C
      • Selection Statements in C
      • Loops in C >
        • Loops in C basic
        • Nested loops in c
      • Arrays in c >
        • Onedimensional Array in c basic
        • Two-dimensional array-matrix in c
      • Strings in C
      • Two-dimensional arrays
      • Pointers in C
      • Functions in C
    • learn C++ >
      • Introducing to C++
      • Data in C++
      • Operators in C++
      • Selection Statements in C++
      • Loops in C++ >
        • Loops in C++ basic
        • Nested loops in c++
      • Arrays in c++ >
        • Introduction to an Array in c++
        • Vectors in c++
        • Two-dimensional array-matrix in c++
        • Maps in c++
        • Two dimensional dynamic arrays in c++
      • Strings in C++
      • Pointers in C++
      • Functions in C++
    • Learn JAVA >
      • Introducing to JAVA
      • Java Basic >
        • Data in JAVA programming
        • Selections statements in JAVA
        • Operators in JAVA
        • Loops in JAVA
        • Arrays in JAVA
      • Object oriented programming >
        • Understanding Java as an Object-Oriented Language
        • Classes and Objects
        • Inheritance of classes
        • Abstract classes and interfaces
        • The visual part of the application >
          • Graphical user interface
          • Events in Java
          • Drawing in window
          • Graphics in JAVA-example
          • Animations in JAVA-examples
          • Applications in JAVA-examples
      • Distance learning java
    • Learn Processing >
      • Intoduction to processing
      • Basic of processing using JAVA
      • Processing and microbit
      • Using vectors in Processing >
        • Vector operations application
      • Processing 2D >
        • Creating Projectile motion animation
        • Processing example: Soccer game shoot
        • Body sliding down a inclined plane
        • Analisys of an inclined plane
        • Circular motion animation in processing
      • Processing 3D >
        • Introducing to 3D processing
        • Movement of 3D objects in processing
    • Arduino and ESP32 programming >
      • Learn Arduino Programming >
        • Intoduction to arduino
        • LDR sensor(light sensor) exercises
        • Arduino temperature sensor - exercises
        • Measuring an unknown resistor
        • Arduino -Ultrasonic sensor
        • Introduction to servo-motors on arduino
        • Moisture soil sensor
      • Learn ESP32 Programming >
        • Intoduction to ESP32
        • ESP32 with servo motors exercise
  • MORE
    • Privacy Policy
    • Links
    • Distance learning
SVET PROGRAMIRANJA

Podešavanja kolačića

Koristimo kolačiće da bismo vam pružili najbolje moguće iskustvo. Takođe nam omogućavaju da analiziramo ponašanje korisnika kako bismo stalno poboljšavali veb lokaciju za vas.

  • Početna
  • WEB APLIKACIJE
    • Popularni programski jezici danas
    • Klase za stil naslovne strane
    • Trendovi u programiranju
    • Internet stvari
    • Kreiranje web sajtova i web aplikacija >
      • Kreiranje web aplikacija
      • Kreiranje web aplikacija 2
      • ASP.NET Core web aplikacije >
        • ASP.NET Core web aplikacije uvod
        • Servisiranje statičkih web strana pomoću web servera
        • Kreiranje sql web api servisa koji čita podatke iz baze
        • Kreiranje kontrolera u asp.net web API aplikaciji
        • Komunikacija Javascript web aplikacije sa API serverom
      • Kreiranje web sajta >
        • Logo Kreator - naslovna
      • Kreiranje Django Web Aplikacije >
        • Kreiranje aplikacije na Heroku Web Platformi 2 >
          • Kreiranje Python Web Aplikacije-početak
        • Python Web Aplikacije
        • Logo Kreator - Kreiranje Naslovne strane
        • Django aplikacija i baza podataka
        • Kreiranje aplikacije na Heroku Web Platformi >
          • Dodavanje modula za registraciju >
            • Dodavanje web strane za logovanje
  • Algoritmi
    • Algoritmi početna - Učenje i Primeri
    • Matematički algoritmi >
      • Fibonačijev niz
      • Prosti brojevi i faktorizacija
      • Eratostenovo sito
      • Euklidov algoritam
      • Maksimalna suma podniza
      • Brzo stepenovanje
    • Strukture podataka >
      • Mapa učenja Strukture podataka
      • Uvod u strukture i unije
      • Uvod u vektore
      • Povezane liste
      • Stek (Stack)
      • Red(Queue)
      • Disjoint Set Union (DSU) strukture+
      • Osnovne strukture podataka
    • Sortiranje nizova >
      • Sortiranje objedinjavanjem
      • Brzo Sortiranje
    • Binarna pretraga
    • Rekurzija i dinamičko programiranje >
      • Rekurzivni algoritmi >
        • Hanojske kule
      • Uvod u dinamičko programiranje
      • Fibonacijev niz DP i memoizacija – objašnjenje i primeri
      • Osnovni DP obrasci >
        • DP: Problem ranca (Knapsack problem)
        • DP: Najduži zajednički podniz (LCS)
        • DP: Subset Sum -problem podskupa sa zadatom sumom
      • Napredni DP obrasci >
        • DP: Minimalan broj kovanica
        • Grid DP problem
        • Edit Distance DP
    • Zamena iteracija formulom
    • Grafovi i stabla >
      • Mapa učenja — Grafovi i stabla
      • Osnove i pretrage >
        • BFS i DFS (pretraga grafova)
        • Topološko sortiranje
        • Otkrivanje ciklusa u usmerenim grafovima
        • Najduži put u DAG-u (DP + topološko sortiranje)
      • Najkraći putevi >
        • Algoritmi grafovi Dijkstra-najkraći put
        • Bellman-Ford i Floyd-Warshall algoritmi
      • Minimalna stabla >
        • MST - Primov algoritam
        • Grafovi MST - Kruskalov algoritam
      • Grafovi Napredno >
        • Eulerovi putevi i ciklusi
        • Mostovi i Artikulisani čvorovi (Tarjanov algoritam)
        • SCC — Komponente jake povezanosti (Kosaraju i Tarjan)
        • DP na DAG-ovima — Primene
    • Napredne tehnike >
      • Podeli pa vladaj
      • Gramzivi algoritmi
  • Primeri - C,C++,Java,Python
    • Primeri iz programiranja – C, C++, Java, Python | Svet Programiranja
    • Osnovni primeri >
      • Podaci-primeri
      • Operatori-primeri
      • Grananje u programu - primeri
      • Petlje primeri >
        • Petlje - osnovni primeri
        • Ugnježdene petlje primeri
      • Stringovi - primeri
      • Nizovi primeri >
        • Nizovi-primeri
        • Sortiranje-primeri
        • Vektori i mape primeri
      • Matrice primeri
      • Funkcije u C/C++ jeziku -primeri
      • Primeri Algoritama >
        • Algoritmi-primeri >
          • Zamena iteracija formulom-primeri >
            • Nedostajući broj-uputstvo
        • Rekurzija-primeri >
          • Prvi i drugi na rang listi
        • Kombinatorika-primeri
        • Bektreking i gruba sila primeri
    • Dodatni primeri sa rešenjima >
      • Dodatni primeri sa rešenjima – algoritmi, petlje, grananje, OOP
      • Podaci i tipovi podataka-dodatni primeri
      • Dodatni primeri za vezbu - grananje u programu
      • Dodatni primeri iz petlji
      • Dodatni primeri za vezbu - Klase i objekti >
        • Ramovi za slike objekti-rešenje
        • Zadatak 2-Grupa radnika objekti
        • Salon Automobila rešenje
        • Zadatak 3. Kretanje automobila objekti-rešenje
        • Upravljanje porudžbinama u restoranu -rešenje zadatka
      • Kombinovani primeri za vezbu >
        • Zadatak 6-Interval-rešenje
    • Takmičenja-primeri >
      • Takmičenja primeri - vodič
      • Priprema za okružna takmičenja 1
      • Priprema za okružna takmičenja 2
      • Kvalifikacije za okružna takmičenja >
        • Datum sa najvećom zaradom-rešenje
        • Zbirovi nakon podele - rešenje
        • Zadatak Mešalica-rešenje
        • Zadatak Kuvar Rešenje
        • Zadatak Slovarica rešenje
        • Zadatak Note rešenje
        • Resenje zadatka Tačan Izraz
        • Zadatak Puž rešenje
        • Zadatak Seča Drva-rešenje
      • Opštinska takmičenja >
        • Zadatak Bejzbol Rešenje
      • Okružna takmičenja >
        • Zadatak Milioner rešenje
        • Zadatak Dve Slike Na Papiru
      • Priprema za državna takmičenja
      • Priprema za više nivoe takmičenja >
        • Priprema za drzavno takmičenje i SIO >
          • Zadatak Aritmetički trougao-rešenje
          • Obilazak konja-zadatak
          • Reči u mreži zadtak-rešenje
        • Interaktivni Algoritmi >
          • Zadatak Joker rešenje
          • Zadatak Boja rešenje
          • Zadatak Maksimizacija BTC
    • Objektno programiranje-primeri >
      • Klase i objekti - primeri
    • Testovi >
      • Testovi i kontrolni zadaci — vežbanje, mini-testovi i priprema
      • Kontrolni podaci
      • Kontrolni selekcije
      • Kontrolni petlje
      • Kontrolni - objekti i metode
      • Kontrolni Nizovi
  • Programski jezici
    • Programski jezici vodič
    • C >
      • C programski jezik
      • Uvod u programski jezik C
      • Elementi jezika C
      • Podaci u C jeziku
      • Operatori u C jeziku
      • Grananje u programu u C jeziku
      • Petlje u C programskom jeziku >
        • Petlje u programskom jeziku C
        • Ugnježdene petlje u C
      • Nizovi u jeziku C >
        • Nizovi u jeziku C
        • Dvodimenzionalni nizovi - matrice
        • Dvodimenzioni dinamički nizovi-matrice
      • C Stringovi
      • Pokazivači u C jeziku
      • Funkcije u C
    • C++ >
      • C++ programski jezik
      • Uvod u programski jezik C++
      • Podaci u C++ jeziku
      • Operatori u C++ jeziku
      • Grananje u programu u C++
      • Petlje u C++ programskom jeziku >
        • Petlje u programskom jeziku C++
        • Ugnježdene petlje u C++
      • Nizovi u C++ jeziku >
        • Nizovi u jeziku C++
        • Dinamički niz-vector
        • Rečnik podataka-mape u C++
        • Dvodimenzionalni nizovi - matrice u c++
        • Dvodimenzioni dinamički nizovi u c++
      • Stringovi u C++ jeziku
      • Pokazivači u C++
      • Funkcije u C++
    • C# >
      • C# – lekcije, primeri i vežbe
      • Uvod u C#
      • Kreiranje jednostavne aplikacije u C#
      • LINQ i Lambda izrazi u C#(Sharp)-u
      • Napredni C#(Sharp) primer
      • Konekcija sa bazom u C#-primer
      • Primer sa MySql bazom podataka
      • Kreiranje Windows Form App Sa SQLServer Bazom
    • JAVA >
      • Java – lekcije, primeri i zadaci
      • Uvod u Javu
      • Java osnove >
        • Podaci u JAVA programskom jeziku
        • Operatori u JAVI
        • Grananje u programu u programskom jeziku Java
        • Petlje u Javi
        • Nizovi u Javi
      • Objektno programiranje >
        • Klase i objekti
        • Metode i objekti
        • Nasleđivanje klasa
        • Apstraktne klase i interfejsi
      • Grafika u JAVI >
        • Grafika u Javi uvod
        • Grafički korisnički interfejs(GUI)
        • Događaji u JAVI
        • Crtanje u prozoru
        • Animacije u Javi-primer
        • Kreiranje 2D igrice u JAVI
        • Grafika u Javi-primer
        • Aplikacije u Javi-primeri
      • Simulacije u fizici >
        • Java i simulacije u fizici
        • Klase i objekti sa primenom u fizici
        • Upotreba ciklusa i nizova u simulacijama iz fizike
        • Primeri simulacija u EJS-u
    • Processing >
      • Processing – lekcije i primeri
      • Processing - uvod
      • Osnove processinga sa Javom
      • Processing i mikrobit
      • Vektori u Processing-u >
        • Opracije sa vektorima
      • Processing u 2D >
        • Kosi hitac u Processing-u
        • Primer kosog hica u processingu
        • Strma ravan u Processing-u
        • Analiza klizanja tela niz strmu ravan primer
        • Animacija Kružnog kretanja
      • Processing u 3D >
        • Uvod u 3D processing
        • Kretanje 3D objekata u processing-u
    • Arduino i ESP32 programiranje >
      • Arduino i ESP32 programiranje
      • Arduino programiranje >
        • Arduino Uno – Uvod
        • Arduino LDR Vežba-Prikaz osvetljenja
        • Arduino senzor temperature
        • DC motor-Upravljanje sa arduinom
      • ESP32 programiranje >
        • Uvod u ESP32
        • ESP32: Ultrazvučni senzor
        • ESP32-Primena kod servo motora
        • ESP32 Pokretanje pumpe za vodu
    • Python >
      • Uvod u python
      • Osnovni Python >
        • Python Osnovni Tutorijal — Početna za lekcije i primere
        • Python osnove >
          • Python za početnike – Instalacija i Prvi Program
          • Prvi program u python-u
          • Aritmetičke operacije u python-u
          • Mini projekti za početnike
          • Promenljive i tipovi podataka
          • Python input() — unos podataka za početnike
          • Formatiranje teksta-F string
          • Mini projekat-python
        • Kontrola toka programa >
          • Python grananje i logički operatori — if / elif / else
          • Grananje u Pythonu — if, elif, else | Svet Programiranjai
          • Mini zadaci- Temperatura i kviz
          • Petlje - while,for
          • Iteracije i osnovni algoritmi u Python-u
          • Mini zadaci — Petlje (for i while)
          • Nizovi i liste u python-u
          • Mini projekat: igra „Pogodi broj“
        • Funkcije i modularno programiranje >
          • Python funkcije
          • Python parametri i povratne vrednosti
          • Python opseg promenljivih
          • Modularno programiranje- moduli i import
        • Mini projekti i praktične vežbe >
          • Projekat: Pogodi broj
          • Mini projekat: Organizacija programa u module
          • Mini projekat — Brojač bodova i statistika
          • Mini projekat — Tekstualni meni
          • Mini projekat — Simulacija semafora
          • Završni mini projekat — Digitalni brojač
      • MycroPython(microbit) >
        • Micro:bit — MicroPython
        • Osnove programiranja (MicroPython) >
          • Uvod i osnovni programi >
            • Uvod u micropython
            • MicroPython: LED matrica — prikaz teksta i slika na micro:bit-u
            • MicroPython — Dugmad
          • MicroPython — Petlje i vreme
          • MicroPython – promenljive i funkcije
          • MicroPython – random i algoritmi
        • Senzori i ulazi >
          • MicroPython — Senzori
          • MicroPython: kompas i temperatura
          • MicroPython – dodatni senzori i aktuatori
        • Komunikacije i Projekti >
          • MicroPython: radio komunikacija
          • MicroPython: radio projekti
          • MicroPython: mini projekti
          • MicroPython – serial i Processing
      • Python + Processing >
        • Python i processing početna
        • Osnova i okruženje >
          • Python i Processing — uvod
          • Instalacija Processing 4
          • Prvi sketch — crtanje
        • Crtanje i grafika >
          • Oblici i boje
        • Animacija i interakcija >
          • Animacija i promenljive
          • Interakcija (miš i tastatura)
        • Mini projekti - igre >
          • Mini projekat: Pong
          • Pong u Pythonu — Score i Game Over
          • Pong sa 2 Igrača u Pythonu — Processing
          • Pong OOP u Pythonu — Modularna igra
          • Nizovi i liste — Python Processing
        • Vizuelizacija i projekti >
          • Crtanje grafikona — Python Processing
          • Interaktivni grafikon — Python Processing
        • Kreativni i takmičarski projekti >
          • Generativna umetnost
          • Projekti za takmičenja
          • Izvoz i prezentacija
      • Python za web
      • Projekti
    • Mikrobit i programiranje >
      • Microbit – Učenje programiranja za osnovce
      • Programiranje mikrobita snove >
        • Uvod u mikrobit
        • Naredbe u Makecode-u
        • Palete komandi Variables, Led. Temperatura i osvetljenje
        • Radio veza na mikrobitu
        • Upotreba promjenljivih i kontrolnih naredbi u programima
        • Kontrolne naredbe u programima mikrobita
        • Petlje-mikrobit
      • Programiranje mikrobita napredno >
        • Igrice i mikrobit
        • Mikrobit projekti i radionice
  • Politika Privatnosti
  • Linkovi
  • Učenje na daljinu
    • Učenje na daljinu-osnovci takmicari