{"id":156,"date":"2018-10-25T13:40:27","date_gmt":"2018-10-25T13:40:27","guid":{"rendered":"https:\/\/books.compclassnotes.com\/elementarycomputing\/?p=156"},"modified":"2018-10-25T13:40:27","modified_gmt":"2018-10-25T13:40:27","slug":"associativity-and-commutativity","status":"publish","type":"post","link":"https:\/\/books.compclassnotes.com\/elementarycomputing\/associativity-and-commutativity\/","title":{"rendered":"Associativity (and Commutativity)"},"content":{"rendered":"<p><em>Associative<\/em> means that the order in which operators are applied doesn&#8217;t matter. For example:<\/p>\n<p class=\"p1\"><span class=\"s1\">(a + b) + c = a + (b + c)<\/span><\/p>\n<p>This means that it doesn&#8217;t matter if we add <strong>a<\/strong> and <strong>b\u00a0<\/strong>first or if we add <strong>b<\/strong> and <strong>c<\/strong> first, we still get the same answer.<\/p>\n<p><em>Commutative<\/em> means that the order of the operands can change without changing the result. For example:<\/p>\n<p class=\"p1\"><span class=\"s1\">a * b = b * a<\/span><\/p>\n<p>This means that\u00a0<strong>*<\/strong>\u00a0<em>is<\/em> commutative. However:<\/p>\n<p class=\"p1\"><span class=\"s1\">a \/ b \u2260 b \/ a<\/span><\/p>\n<p>Which means that\u00a0<strong>\/<\/strong>\u00a0<em>is not<\/em> commutative.<\/p>\n<p>Here are some simple examples:<\/p>\n<ul>\n<li class=\"p1\"><span class=\"s1\">3 * 4 = 12<\/span><\/li>\n<li class=\"p1\"><span class=\"s1\">4 * 3 = 12<\/span><\/li>\n<li class=\"p1\"><span class=\"s1\">6 \/ 2 = 3<\/span><\/li>\n<li class=\"p1\"><span class=\"s1\">2 \/ 6 = <\/span><span class=\"s2\">\u2153<\/span><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Associative means that the order in which operators are applied doesn&#8217;t matter. For example: (a + b) + c = a + (b + c) This means that it doesn&#8217;t matter if we add a and b\u00a0first or if we <span class=\"readmore\"><a href=\"https:\/\/books.compclassnotes.com\/elementarycomputing\/associativity-and-commutativity\/\">Continue Reading<\/a><\/span><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-156","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/books.compclassnotes.com\/elementarycomputing\/wp-json\/wp\/v2\/posts\/156","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/books.compclassnotes.com\/elementarycomputing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/books.compclassnotes.com\/elementarycomputing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/books.compclassnotes.com\/elementarycomputing\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/books.compclassnotes.com\/elementarycomputing\/wp-json\/wp\/v2\/comments?post=156"}],"version-history":[{"count":1,"href":"https:\/\/books.compclassnotes.com\/elementarycomputing\/wp-json\/wp\/v2\/posts\/156\/revisions"}],"predecessor-version":[{"id":157,"href":"https:\/\/books.compclassnotes.com\/elementarycomputing\/wp-json\/wp\/v2\/posts\/156\/revisions\/157"}],"wp:attachment":[{"href":"https:\/\/books.compclassnotes.com\/elementarycomputing\/wp-json\/wp\/v2\/media?parent=156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/books.compclassnotes.com\/elementarycomputing\/wp-json\/wp\/v2\/categories?post=156"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/books.compclassnotes.com\/elementarycomputing\/wp-json\/wp\/v2\/tags?post=156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}