Git Product home page Git Product logo

processing's Introduction

Processing

Cool and Useful Projects in Processing. For every one of these projects, I will have a YouTube video explaining it in details on My YouTube Channel.

If you have any questions or suggestions you can contact me on YouTube or on my email: [email protected] I commented the code too, so always first read the comments before asking anything... Thanks...

Projects

The projects include multiple .pde files and everything that I have and I will be doing is going to be sorted in classes. I like Processing because It allows you to things like nested classes, functions... Also comparing the Object Oriented Features in Processing with O.O. Features in other popular languages, you are going to see great advantages in Processing...

DRAGGABLE WINDOWS with Children

on YouTube

on YouTube

MERGE SORT -- Keeping Track of Original Indexes

on YouTube

on YouTube -- It is a very easy algorithm to understand compared to other sorting algorithms. I know that there is already algorithm/function for sorting elements in an array inside Processing, but the reason why I wrote it from scratch is to keep track of the original indexes. What does that mean?

---- Let's say we make an unsorted array of ints:

	int[] array = {3, 5, 1, 3, 2, 9, 8};
	// Indexes:    0  1  2  3  4  5  6

---- Than if we sort the array in the usual way you are going to get this new array:

	int[] sortedArray = {1, 2, 3, 3, 5, 8, 9};

---- And if you want to know the original index of 'for ex. 9', you would need to search the whole array once again needing O(n) operations... To match every number, you would need n*n => n^2 operations just to match the numbers after sorting...

---- The Ordinary MERGE SORT Algorithm has a complexity of n log n and takes 2n memory

---- My MERGE SORT Algorithm with the ability to keep track of the original indexes has the same complexity of n log n and takes 3n memory space.

---- So sorting the array using my MERGE SORT Algo. will give you:

	int[] sortedArray = {1, 2, 3, 3, 5, 8, 9};
	int[] indexes     = {2, 4, 0, 3, 1, 6, 5};

---- As you can see, it doesn't just sort the array, but it keeps track of the indexes too.

Why would you need it?

If you have an ArrayList of Objects and you need to sort them according some property, you would make an array of the values of that property and than you would just sort the newly created array. After that you can grab the "array of indexes" from the algorithm, and according to the indexes operate on the Objects.

TEXTBOX

on YouTube

GREEDY PACKING ALGORITHM

on YouTube

processing's People

Contributors

mitkonikov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.