Friday, November 25, 2016

Algorithmic efficiency

The efficiency of a computer user algorithm  is a topic of obvious practical importance .In computer scicne , there's always multiple ways to do any simple question and they will all work without any compile errors, if they're coded correctly.However,it's also Important to consider how efficient each way is interms of performance and productivity.

Algorithmic efficiency in computer scicne is defended by Wikipedia as the properties of an algorithm which relate to the amount of computational resources used by the algorithm.
So as the definition suggest , algorithmic efficiency is looking at the software in terms of how it's using all the resources available.Is it using all the memory for nothing ? Is it doing processes that are extra load ? 




Algorithmic efficiency relationships
 
By answering all these questions,a developer will be able to produce the most efficient algorithm that should have the feature of being:
General: An algorithm that works with more than one similar problem so it's not only limited to solving only one.
Concise: An algorithm that doesn't repeat itself without any reason or a one that uses every method for a reason. 
Expandable: An algorithm that can be improved up on and updated throughout time so it should be understandable for other developers too.

Algorithmic efficiency is something that has been introduced into computer science since the it's early days and it has been with it since then because it's such an essential element for developing a useful and efficient program 

References:
1-https://en.m.wikipedia.org/wiki/Algorithmic_efficiency
2-https://apelbaum.files.wordpress.com/2011/10/yaacovapelbaumbigoplot.jpg

Friday, November 18, 2016

Trees

This might sound like it's an article not related to computer science,but in computer science trees refer to an advanced data structure concept that's very useful for ordered collections and the way we represent them in coding.

What's a tree ?

Wikipedia defines a tree as a widely used abstract type(ADT) can be defined recursively (locally) as a collection of nodes (starting at a root node), where each node is a data structure consisting of a value, together with a list of references to nodes (the "children"), with the constraints that no reference is duplicated, and none points to the root.

What are some properties of a theoretical tree?

Much similar to plants, data structures trees have some properties that specify them.Some of these properties are:
1-Height :the length of its longest path or the deepest depth 
2-Depth:the length of its root path
3-Path length:the sum of the depths of all nodes
4-Width:the size of the largest level 

How's that connected to programming ? What's a binary tree?

It's an ordered tree in which every internal node has two distinguished subtrees.
Binary trees are more important than general trees or unordered trees because they have a pattern that works with the machine language(0s and 1s),so that's what makes a binary tree one of the most widely used internal data structures in computing 



Some applications of binary trees ?

1-Binary search trees :a binary tree in which for each key in the tree, all the keys in its left subtree are less than it and all the keys in its rights subtrees are greater than it.
2-Fibonacci tress:built on the same structure of the Fibonacci numbers that we took earlier in the semester 

3-AVL trees :a binary search tree that maintains its balance by forcing the two subtrees at any node to have nearly the same height.This is done by rotating subtrees whenever an imbalance occurs through an algorithm

References:
1-https://en.wikipedia.org/wiki/Tree_(data_structure)
2-https://upload.wikimedia.org/wikipedia/commons/thumb/f/f7/Binary_tree.svg/220px-Binary_tree.svg.png
3-https://www.cs.cmu.edu/~adamchik/15-121/lectures/Trees/pix/binaryTree.bmp
4-https://upload.wikimedia.org/wikipedia/commons/thumb/e/ea/Fibonacci_Tree_5.svg/372px-Fibonacci_Tree_5.svg.png
5-https://www.cs.auckland.ac.nz/software/AlgAnim/fig/AVL1a.gif







Friday, November 11, 2016

Computer graphics in Object Oriented Programming

In the last couple of weeks, we've been talking about the idea of object oriented programming and how it eases applying major ideas that could be impossible to do without organizing the idea into separate objects that interact together.One of these applications is computer graphics.

What's computer graphics ?

In general ,Computer graphics is the science and art of communicating visually via a computer’s display and its interaction devices. Computer graphics is an explosive and complex field ,with rapid advances in both theory and practice ,so instead of changing the whole API an alternative is implementing a highly adaptable organization built on objects by creating separate files for every function needed.

Why would we combine computer graphics and object oriented programming ?

Combining saturated graphics with object oriented programming is essential  allows programmers to conveniently construct interactive displays and it's object oriented programming interface (API) allows these structure to be easily reused and extended,thus allowing more flexibility to model application-specific graphics, which allows non-expert programmers to create creative apps without having to build the whole code on their own.

Are there any things that we have to keep in mind while using computer graphics ?


Of course,for a computer scientist to manipulate object oriented programming to use extensive graphics, he/she has to make sure to be careful to most of the details like resolution, transition,pixels,file types, coordinate system , booleans ,transition and vertex because without taking these into consideration, it will end up to be a big mess.

Lastly , a great example go computer graphics in object oriented programming is StdDraw which we have been using since the second weekend maybe the 1000 lines it had seemed scary back then and still confusing till now, it doesn't matter anyways because we only have to know how to implement it.
A product of StdDraw
References:
1-http://www.cs.cornell.edu/courses/cs4620/2010fa/Competition/img/1/8.jpg
2-http://www.cis.upenn.edu/~cis110/14su/hw/hw03/gallery/juschang-4.png