background preloader

GeeksforGeeks

GeeksforGeeks
Related:  capetrel

Algo Muse 16-1 In the box There are n identical boxes in which 2n balls are equally distributed. The balls are labelled from 1 to 2n. We don't know which ball is in which box, but do know that each box contains two balls. The objective is to learn the arrangement of balls. For any set of balls S ⊆ {1,...,2n} we can ask a query of the form `How many boxes contain the balls in S?'. Prove that we can learn the distribution of balls by asking O(n log n) queries. Note that we cannot tell which ball is in which box. Solution Solution There are n pairs of balls. Lemma. Proof. How many boxes contain the balls in set A? If answers to both the questions are same, then x is paired with one of the balls in set A; else x is paired with one of the balls in set B. 16-2 Evasive Tree We prove the lower bound for the special case when the tree is a path, using an adversarial argument. Assume that the algorithm never asks a query to which it can infer the answer. Analysis. 16-3 Saving a log

SVG and CSS - Cascading Style Sheets It is possible to style your SVG shapes using CSS. By styling is meant to change the looks of the shapes. This can be stroke color and width, fill color, opacity and many other properties of your shapes. There are 6 ways to style the shapes in your SVG images. Each will be covered in this text. At the end of this text you will find a list of the CSS properties you can use with SVG. This text assumes that you are familiar with CSS. CSS Styling Using Attributes Is it possible to style an SVG shape using specific style attributes like stroke and fill. There are a range of styling attributes available. Using the style Attribute and CSS Properties This method doesn't use any style specific attributes. Here is the same circle with the stroke and fill set via the style attribute and CSS properties: Using Inline Style Sheets It is possible to define the styles for your shapes in an inline style sheet, and then have all these styles automatically applied to your shapes. The class Attribute

Stanford CS Ed Library 50 Essential Online Tools For Every Computer Science Student | Computer Science Zone Computer science students need to acquire skills in multiple areas — arguably more so than many other study disciplines. So not surprisingly, they need a large toolbox, for any of several activities encountered in the typical college program. To that end, here is a reference list of 50 essential tools (software and resources) for computer science students. Notes: We’ve left out the typical Web browsers, email clients, most IM/ chat clients, search engines, video sharing sites, etc., and given a sample of tool categories that have numerous options.Some tools listed are free, others follow a freemium model (free with paid upgrade options). Communication and Collaboration Google Hangouts: Free group conversations and live voice and video, from a browser or mobile app.Strike: Create Web-based task lists and share with classmates, colleagues and other collaborators. Data Parsing, Data Conversion, File Retrieval, Format Checking JSONLint: Validate JSON content and convert to prettyprint mode.Mr.

Programming, Software, and Technical Interview Questions - XOR Swap Slim Framework - Slim Framework FilePermissions Understanding and Using File Permissions In Linux and Unix, everything is a file. Directories are files, files are files and devices are files. To change or edit files that are owned by root, sudo must be used - please see RootSudo for details. If the owner read & execute bit are on, then the permissions are: -r-x------ There are three types of access restrictions: There are also three types of user restrictions: Note: The restriction type scope is not inheritable: the file owner will be unaffected by restrictions set for his group or everybody else. Folder/Directory Permissions Directories have directory permissions. read restricts or allows viewing the directories contents, i.e. ls command write restricts or allows creating new files or deleting files in the directory. Folders (directories) must have 'execute' permissions set (x or 1), or folders (directories) will NOT FUNCTION as folders (directories) and WILL DISAPPEAR from view in the file browser (Nautilus). Permissions in Action ... ToDo

programming language agnostic - What are the lesser known but useful data structures Demo of a simple CRUD RESTful PHP service used with AngularJS and MySQL <?php require_once("Rest.inc.php"); class API extends REST { public $data = ""; const DB_SERVER = "127.0.0.1"; const DB_USER = "root"; const DB_PASSWORD = ""; const DB = "angularcode_customer"; private $db = NULL; private $mysqli = NULL; public function __construct(){ parent::__construct(); // Init parent contructor $this->dbConnect(); // Initiate Database connection * Connect to Database private function dbConnect(){ $this->mysqli = new mysqli(self::DB_SERVER, self::DB_USER, self::DB_PASSWORD, self::DB); * Dynmically call the method based on the query string public function processApi(){ $func = strtolower(trim(str_replace("/","",$_REQUEST['x']))); if((int)method_exists($this,$func) > 0) $this->$func(); else $this->response('',404); // If the method not exist with in this class "Page not found". private function login(){ if($this->get_request_method() ! $this->response('',406); $email = $this->_request['email']; $password = $this->_request['pwd']; if(! if(filter_var($email, FILTER_VALIDATE_EMAIL)){ if($id > 0){

Linux File Permissions Tutorial December 14, 2011By Roman Rafacz What we’ll cover in this article is how to identify permissions for files & directories and how to change them, as well as changing ownerships, groups, etc. Depending on what you want to do, you’ll want to make sure you have the appropriate permissions (obviously), so let’s find out how to change them. Let’s start by making a file we can use. I issued the “touch” command to make a file creatively named testfile. Touch will just create an empty file but has all the same attributes as an actual file. Commands: touch test file mkdir workfolder The permisions are broken into 4 sections. chmod – adds and removes permissions If you wanted to add or remove permissions to the user, use the command “chmod” with a “+” or “–“, along with the r (read), w (write), x (execute) attribute followed by the name of the directory or file. chmod +rwx “name of the file” chmod –rwx “name of the directory” chmod +x testfile – this would allow me to execute chmod g+w testfile Examples: 1 = –x

Practice and Learn - Google Code Jam On this page you can see results and code from past rounds of Google Code Jam, and you can try the problems for yourself. If you're new to Code Jam, try following the Quick-Start Guide. Where should I start? If you're new to programming contests, we highly recommend starting with the least difficult problems and moving up from there as you get more confident. Beware: the round that has the easiest problem A may have a very difficult problem B! As you get used to the platform, you can check how many people solved each problem in the "Submissions" box to the left of the dashboard, and use that as a rough gauge of difficulty. Here are some choice problems for new competitors: Africa 2010, Qualification Round: Store Credit, Reverse Words. Remember, if you get stuck you can look at someone else's solution (click a "solutions" link below) or join our mailing list and ask for help. Finding Solutions You can click a "solutions" link below, but those aren't really indexed in a helpful way. TopCoder

Related: