Posts

Showing posts with the label Computer Science

Empirical Analysis of a Brute Force Algorithm for Median Search

Image
This paper serves as a brief analysis of a number of computational experiments examining the running time and complexity of a brute force median selection algorithm.  C++ was used to implement and test the algorithm, while Python’s matplotlib.pyplot library was used to graphically visualise results. The main focus of the report was to test whether the theoretical prediction for the algorithms average-case time-complexity is consistent with observations. 1. Description of the Algorithm The algorithm, called BruteForceMedian (see Appendix A), is a median search algorithm which takes an array of ordered or unordered integers as input, and returns the median value of that list.  Unlike other algorithms used for finding a median, BruteForceMedian does not reshuffle or sort the input array, but rather compares every element of the array against every other element iteratively, including itself, until it determines the kth value in the list if it were sorted. It is important to note that

Facebook SMS Notifications Security Vulnerability

Image
Many services such as facebook require users to sign up with a valid mobile number and can choose to receive messages via SMS at their convenience. Facebook includes this option, and many users take advantage of this system. If a mobile number has been disconnected, after a period of time, the disconnected mobile number is recirculated in the available number pool and can be distributed to buyers of new sim cards. Failure to update your facebook mobile number may leave your account vulnerable to third parties. I personally experienced this vulnerability myself when purchasing a new sim card. I was given a choice of one from about twenty different available numbers in the number pool. I arbitrarily picked one of the numbers which seemed easy to remember. After setting up my new sim card I began receiving sms messages from facebook with links to updates from apparent friends and family. After checking that the sms messages were legitimately from facebook, I opened one of the links, o

Projectile Motion Paths in MatLab

Image
The following is a MATLAB script which produces the projectile paths of a spherical object, such as a cannonball, given  radius (r), mass (m), initial velocity (v), and angle above the horizontal (theta) . By changing the experimental variables mentioned above, and others attributed to the environment, such as the  density of air (rho) ,  gravity (g)  and the  drag coefficient (C)  the various effects can be visualised in the graph this script outputs.  ifr=1; C=0; C1 = 0.5; theta=35;    v = 50;        g= 9.80;     dt = 0.0001;  i = 1; max_iters = 1000000; x(1) = 0; y(1) = 0; x1(1) = 0; y1(1) = 0; t0 = 0; while ifr<=2     r=0.036*ifr;     m=0.145*ifr^3;     rho=1.2;          A=pi*r^2; A1=pi*r^2;     D=rho*C*A/2; D1=rho*C1*A1/2;          vx =v*cosd(theta); vx1 =v*cosd(theta);     vy =v*sind(theta); vy1 =v*sind(theta);       while y(i) >= 0 && i < max_iters           ay=-g; ay1=-g-(D1/m)*(vx1^2+vy1^2)^0.5*vy1;  

Raspberry Pirate Radio

Image
Using a Raspberry Pi and a plain 10-20 cm wire with the ability to be connected to an individual GPIO pin as an antenna, it’s possible to transmit radio at a distance of up to 50m or so depending on several factors, including whether or not local interference is causing feedback, or the conductive attributes of the transmitting wire. In my case, a single unsoldered breadboard jumper cable was used as an antenna. This can be used for a variety of purposes. For example, you could transmit encrypted messages across radio waves, block actual radio stations locally and replace their broadcasts with your own, or simply use it to send audio to different radio enabled speakers around your household. By using PiFM, Youtube-dl, and ffmpeg, it is possible to download and broadcast youtube audio to whatever radio frequency you would like.  This post is just a quick introduction to using a Raspberry Pi as your own personal radio transmitter. PiFM is the library used to transmit an audio f